Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I have small application VS2015 Visual C++, WindowsForms. And I try to print the RDLC report directly to the printer. For that when I tried, I get struck, while I render the report.
Any kind advices will be enable to complete the task.
Thanks
public: static System::Void Export(LocalReport^ report, bool print = true){
		PaperSize^ paperSize = m_pageSettings->PaperSize;
		Margins^ margins = m_pageSettings->Margins;

		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));
		//Microsoft::Reporting::WinForms::Warning^ warnings;
		System::Collections::Generic::IList<Warning^>^ warnings;
		m_streams = gcnew List<Stream^>();

                //I get error messages at the below report->Render lines.

		report->Render("Image", deviceInfo, CreateStream, warnings);  ??????????????????????????????????



		for each(Stream^ stream in m_streams) {
			stream->Position = 0;
		}
		if (print==true){
			Print();
		}
	}


Error Message :
No Instance of Overloaded function MIcrosoft::Reporting::Winforms::LocalReport::Render matches the arguement types are (const char[6], String^, Stream^(String^ name, String^ fileNameExtension, System::Text::Encoding^ encoding, String^ mimetype, bool willseek), System::Collections::Generic::IList<Microsoft::Reporting::WinForms::Warning^>^) object type is Microsoft::Reporting::WinForms::LocalReport^  


Thanks Again

What I have tried:

I try to print the RDLC report directly to the printer
Posted
Comments
M-Badger 3-Mar-24 9:26am    
What overloads of the Render method exist ?
Do any of them take the types that you are calling with ?

What is the definition of the CreateStream method ?
What is its return type ?
Does that match the signature of the Render method ?

1 solution

 
Share this answer
 
Comments
Paramu1973 3-Mar-24 9:56am    
Thanks Richard, always I learned many things. This Richard is my profession.
Here is the error.
can't take address of 'PrintRDLCReport::CreateStream' unless creating delegate instance
public: static Stream^ CreateStream(String^ name, String^ fileNameExtension, Encoding^ encoding, String^ mimeType, bool willSeek){
		//Stream^ stream = gcnew MemoryStream();
		stream = gcnew FileStream(name + "." + fileNameExtension,FileMode::Create);
		m_streams->Add(stream);
		return stream;
	}
Richard MacCutchan 3-Mar-24 10:02am    
Again I refer you to the documentation for the callback: CreateStreamCallback Delegate (Microsoft.Reporting.WinForms) | Microsoft Learn[^].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900