Where is there a sample of how to put elements together for printing?
I am looking for a code sample showing me how to put the output of a webgrid along with maybe an HTML header and footer to a PDF.
I can't really speak for the web aspect of things, since I'm a Windows Forms developer, but I would think that the WebGrid exports its contents to an ISection of a Report object. Assuming that you receive a handle to this ISection object, you have the ability to add a Header or Fotter object yourself. The Documents engine does not support parsing HTML, however, so you would have to do this yourself in order to apply appearances to those objects. The IText element has a limited ability to parse HTML tags that describe the text it shows; you can use the AddRichContent method for this.
As for samples, I believe the SDK comes with samples for the Documents engine showing how to use the various elements, though again I can't speak for the web SDK; I would think that it should be included.
-Matt
Here was the answer to my question: Thanks for pointing me in the right direction Matt.
http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR2.0/html/Infragistics2.WebUI.UltraWebGrid.DocumentExport.v8.3~Infragistics.WebUI.UltraWebGrid.DocumentExport.UltraWebGridDocumentExporter~Export(UltraWebGrid,Report).html
The only thing you can do with the excel exporter is export a standard grid. You cant even move the rows on different X or Y axis and export it.
Hopefully they will improve on this in a new release.
What i need is to print the content of a UltraWebGrid, my idea was to export the grid contect using the export method from the ExcelExporter pasing a instance of a Document.Report.Report as parameter and then use the Report.Print() method.
Anyway this does not work...
Do you has any idea of how to accomplish this issue?
The excel exporter doesn't have any concept of what a report object is; are you sure you don't mean the DocumentExporter? Since I'm a Windows Forms developer, I'm not sure what methods are available to the UltraWebGridDocumentExporter, but if one of those overloads takes an ISection, then you could create your own section to export the grid to, then populate the rest of the report yourself, i.e.:
Report report = new Report();
ISection section = report.AddSection();
exporter.Export(..., section); //Not sure what the overloads are here
// Add more content to report here
report.Publish(...);
you are right...
I mean the DocumentExporter...
document.Export(Grid, Report)
Report.Print(printerName)
but I cant make this work...
The Report.Print() method will print the report on a printer connected to the server. In a web environment, this is generally not what you want.
A better solution for printing WebGrid is to create a "printer friendly" page. WebGrid has a setting to emit printer-friendly HTML, by setting its DisplayLayout.ReadOnly property to ReadOnly.PrintingFriendly. You can then use the browser's Print functionality to print the resulting page, including the "window.print()" JavaScript function.
Alternately, you can generate the report to be sent back down to the client machine, and the user can use the print functionality of their PDF viewer to actually print the report. The limitation here is that you can't automate this printing task.
This isn't really possible to implement in WebGrid. You can't use server-side code to print to a client-side machine - the server has no access to the client's resources.
WinGrid is able to do this because the "client" machine (the one that the user is running the application from) and the "server" machine (the one that's actually running the application code) is generally the same machine.
The closest you can come to this with WebGrid is to use server-side code to emit JavaScript that, when evaluated, causes the page to print.
This could be a great feature for future versions of the UltraWebGrid...
the windows grid have a Print method (I think)