Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

without loading VS2005 on user machine how to make app work?  Dev

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rich - 20 Mar 2008 21:45 GMT
On my development machine where I have Visual Studio 2005 loaded, I have an
app that uses the Report control.  I can view data in report format with the
Report control -- the data renders OK in the Report control.  My problem is
in rendering the report from the rdlc file for printing to a line printer.  

Following the example from MSDN Help at

http://msdn2.microsoft.com/en-us/library/ms252172(VS.80).aspx

I can print the rdlc report file to the line printer from my development
machine.  But I deployed the same app app to a User's machine (using Click
once), and the print job failed at

report.Render("Image", deviceInfo, CreateStream, out warnings);

Does anyone have any idea what file/reference/library I need to include in
the deploy without having to load VS2005 on the user machine?  Note:  I am
already including the refence to Microsoft.ReportViewer.Common and
Microsoft.ReportViewer.Winforms, and I already copy the entire content of the
Report rdlc file

Here is the area where the print job is failing (--the entire code for the
print routine is at
http://msdn2.microsoft.com/en-us/library/ms252172(VS.80).aspx--)

   private Stream CreateStream(string name, string fileNameExtension,
     Encoding encoding, string mimeType, bool willSeek)
   {
       Stream stream = new FileStream(name + "." + fileNameExtension,
         FileMode.Create);
       m_streams.Add(stream);
       return stream;
   }

   private void Export(LocalReport report)
   {
       string deviceInfo =
         "<DeviceInfo>" +
         "  <OutputFormat>EMF</OutputFormat>" +
         "  <PageWidth>8.5in</PageWidth>" +
         "  <PageHeight>11in</PageHeight>" +
         "  <MarginTop>0.25in</MarginTop>" +
         "  <MarginLeft>0.25in</MarginLeft>" +
         "  <MarginRight>0.25in</MarginRight>" +
         "  <MarginBottom>0.25in</MarginBottom>" +
         "</DeviceInfo>";
       Warning[] warnings;
       m_streams = new List<Stream>();
report.Render("Image", deviceInfo, CreateStream, out warnings);  <<<---fails
here

       foreach (Stream stream in m_streams)
           stream.Position = 0;
   }
Rich - 20 Mar 2008 23:09 GMT
I observed that I my own development machine, I have the same printing
problem from the deployed application, but if I invoke the exe from
.../bin/debug/myapp.exe
then the print works OK.  So obviously something is not getting deployed.  I
need to include something in the Prerequisites ... but what?

> On my development machine where I have Visual Studio 2005 loaded, I have an
> app that uses the Report control.  I can view data in report format with the
[quoted text clipped - 50 lines]
>             stream.Position = 0;
>     }
Rich - 21 Mar 2008 18:50 GMT
I found the problem and post the solution - for future reference.

The problem was with the report rendering.  It turns out that in the
development environment I was referencing the rdlc file in one location on
the dev machine which was not in the bin folder, but on deployment the rdlc
file was deploying with the .exe to a subfolder in the
application.startupPath.  So I changed my path reference to
application.startupPath\subfolder   and now the operation works correctly
after deployment.

> On my development machine where I have Visual Studio 2005 loaded, I have an
> app that uses the Report control.  I can view data in report format with the
[quoted text clipped - 50 lines]
>             stream.Position = 0;
>     }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.