-
March 4th, 2024, 11:39 AM
#1
How to create delegate stream
Hi, Iam using VS2015 Winforms, VC++. C++/CLI With my application I try to print the rdlc report. And I get the below error.
can't take address of 'PrintRDLCReport::CreateStream' unless creating delegate instance.
Code:
private: static Stream^ stream = gcnew MemoryStream();
public: static Stream^ CreateStream(String^ name, String^ fileNameExtension, Encoding^ encoding, String^ mimeType, bool willSeek){
//Stream^ stream = gcnew MemoryStream();
stream = gcnew MemoryStream();
//stream = gcnew FileStream(name + "." + fileNameExtension,FileMode::Create);
m_streams->Add(stream);
return stream;
}
public: static System::Void Export(LocalReport^ report, bool print){
PaperSize^ paperSize = m_pageSettings->PaperSize;
Margins^ margins = m_pageSettings->Margins;
print = true;
String^ deviceInfo = String::Format(CultureInfo::InvariantCulture,
"<DeviceInfo>" +
"<OutputFormat>EMF</OutputFormat>" +
"<PageWidth>{5}</PageWidth>" +
"<PageHeight>{4}</PageHeight>" +
"<MarginTop>{0}</MarginTop>" +
"<MarginLeft>{1}</MarginLeft>" +
"<MarginRight>{2}</MarginRight>" +
"<MarginBottom>{3}</MarginBottom>" +
"</DeviceInfo>",
ToInches(margins->Top),
ToInches(margins->Left),
ToInches(margins->Right),
ToInches(margins->Bottom),
ToInches(paperSize->Height),
ToInches(paperSize->Width));
cli::array<Warning^>^ warnings;
m_streams = gcnew List<Stream^>();
report->Render("Image", deviceInfo, CreateStream, warnings); ?????????????????????????
This above line CreateStream generates the error
can't take address of 'PrintRDLCReport::CreateStream' unless creating delegate instance
for each(Stream^ stream in m_streams) {
stream->Position = 0;
}
if (print==true){
Print();
}
}
Thanks for the kind advice, Thanks again !
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|