-
June 16th, 2015, 04:29 PM
#1
[RESOLVED] Convert From c# - For Report Viewer Report save as PDF
Hi Iam using the below codes to save the report as PDF in c#...Is it possible to convert it in C++/Cli
Thanks
My Codes
byte[] Bytes = Reportviewer1.LocalReport.Render(format:"PDF",deviceInfo:"");
using (FileStream stream = new FileStream("C:\MyFolder", FileMode.Create))
{
stream.Write(Bytes, 0, Bytes.Length);
}
Last edited by MAHEY; June 17th, 2015 at 01:33 AM.
Reason: Edited as ReportViewer1
-
June 17th, 2015, 05:53 AM
#2
Re: Convert From c# - For Report Viewer Report save as PDF
Doesn't look complicated. What's the problem?
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
June 17th, 2015, 08:05 PM
#3
Re: Convert From c# - For Report Viewer Report save as PDF
Hi ERI, Thanks for the helps ERI. Still Iam keeping my Boolean Variable Names as ERI, to remember your helps...
I tried like the below manner, but showing the "error C2143: syntax error : missing ';' before '[' "
System::Byte[]^ Bytes = reportViewer1->LocalReport->Render("PDF", "");
System::IO::FileStream^ stream = gcnew System::IO::FileStream("C:\\", System::IO::FileMode::Create){
stream->Write(Bytes, 0, Bytes->Length);
}
Thanks ERI
-
June 18th, 2015, 06:57 AM
#4
Re: Convert From c# - For Report Viewer Report save as PDF
array<System::Byte>^ Bytes = reportViewer1->LocalReport->Render("PDF", "");
-
June 18th, 2015, 09:22 AM
#5
Re: Convert From c# - For Report Viewer Report save as PDF
Yes, you got the array syntax wrong, and Alex already posted the correction.
Also, there's no direct equivalent to the C# using construct in C++/CLI, and what you posted doesn't syntactically make sense in C++/CLI. What comes closest to the using construct in C++/CLI would be the use of an implicitly dereferenced variable. (You can use forum search to find a few threads discussing this, and perhaps find a bit more details about what it does.) This is what it would look like:
Code:
{
System::IO::FileStream stream("C:\\MyFolder", System::IO::FileMode::Create);
stream.Write(Bytes, 0, Bytes->Length);
}
Note that the omission of the ^ in the second line and use of the dot operator instead of -> in the third line are no mistakes: Implictitly dereferenced variables of reference types use value type syntax.
Though it may seem so on first look, the uncontrolled brace pair surrounding the code snippet is not redundant. It limits the scope of the variable stream so that the stream gets implicitly closed when execution reaches the closing brace.
Last edited by Eri523; June 18th, 2015 at 09:25 AM.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
June 18th, 2015, 12:09 PM
#6
Re: [RESOLVED] Convert From c# - For Report Viewer Report save as PDF
Thanks to those kindness.....I get very clear...
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
|