Grid control contents can be exported to an XLS, PDF, MS Word, and HTML files.
This sample demonstrates the export of grid contents to an XLS file as well as the import of XLS file content to a grid control.
Interactive Features:
XlsIO libraries are used to support conversion of grid content to Excel.
Dependent assemblies are Syncfusion.XlsIO.Base and Syncfusion.GridConverter.Windows.
An An excel sheet can also be imported to the grid control using the ExcelToGrid() method.
EXCEL Export
This sample demonstrates the export of grid content to a PDF
file.
Interactive Features
This implementation allows multiple options to have modifications on a PDF file according to its features such as adding headers and footers for all the pages and specifying the margin.
PDF libraries are used to support the conversion of grid content to a PDF page.
Dependent assemblies are Syncfusion.Pdf.Base and Syncfusion.GridHelperClasses.Windows.
Two new events has been implemented in the PDF converter.
Events
Exporting - raises before the Export
Exported - raises after the Export
PDF Export
This sample demonstrates the export of grid content to an HTML file. It also includes an option to copy selected content from a grid to the clipboard.
Interactive Features:
Conversion is achieved by preparing an HTML file for the content of the grid.
This is a two-step process as explained below:
Retrieve an entire range of cells in a grid.
Translate every element within the range to its corresponding HTML equivalent.
This can be achieved by checking each cell type and adding an equivalent code using HTML to create the corresponding cell control.
Below is an image of a HTML Export.
HTML Export
This sample demonstrates the export of grid data to a Word document. It also illustrates support for headers and footers.
Interactive Features
GridWordConverter converter = new GridWordConverter(true, true);
converter.GridToWord("Sample.doc", gridControl1);
//Header event to create an header, that will display on each page
converter.DrawHeader += new GridWordConverterBase.DrawDocHeaderFooterEventHandler(converter_DrawHeader);
//Footer event to create a footer, that will display on each page
converter.DrawFooter += new GridWordConverterBase.DrawDocHeaderFooterEventHandler(converter_DrawFooter);
Below is an image of a Word export.
Word Export