Hello! I am using the Excel Export functionlity and I am wondering if it is possible to just export the a value in a grid cell straight into a cell in the excel file? Currently, the export functionality changes font, font size, colors etc. and makes some of our formulas in my excel file to stop working. Is there some specific setting that we can use to just focus on the value and not the formatting?
/Henrik
Hello Henrik,
Thank you for contacting Infragistics. With our WinGridExcelExporter, by default, the exporter will emulate what's seen in the grid over to excel. Note the exporter's ExportFormulas property is set to true by default. When true, the exporter will attempt to convert grid formulas into equivalent formulas in the exported worksheet. But it won't be 1:1 since DotNet and Excel differ. When false it will copy the value as seen in the grid.
The exporter has several events such as BeginExport and CellExporting that gives you access to the grid data before it is written into the Excel file, so you can perform pre-processing. You can also perform post-processing on the data after it has been written into the file by using the CellExported event. But to answer your question you can easily remove styles made to the file before the grid is exported by hooking BeginExport and calling some reset methods on the layout.
e.Layout.ResetOverride();e.Layout.ResetAppearance();
For more details please visit:www.infragistics.com/.../wingridexcelexporter-export-grid-data-to-excel
Thanks for coming back. Yes, i know more or less all those features that you mention, but i am still wondering if this component can be used to just export that value from the grid. The excel file that we write to are already formatted in the way that we want, so spending time on formatting how the data should look like coming from the grid feels a bit like a waste of time. Is it possible?
if you are saying resetoverride, resetappearance it feels like it is about formatting the grid which i dont want to focus om, neither formatting the excel file, if you understand what i mean.
I hope you understand what i am looking for…
ideas?
This was previously discussed here:
https://es.infragistics.com/community/forums/f/ultimate-ui-for-windows-forms/122486/ultragridexcelexporter-exporting-over-40-000-rows-of-data-speed-issue/539268#539268
Just remember to hook BeginExport and modify the layout from the event args (which is the cloned version of the layout)
Ok. If i dont change any formatting in the beginexport or cellexported, i get the segoue font in 8 pt. But since the excel file works with 10pt arial, i have to change this. But there is still forecolor, background color, data type of excel cell etc. that is changed in the excel file.
i know that i am using a style (office something), but the question is, even if i use a style or not, will soemthing from the grid still be styled when it is exported?. If is is, are the other ways to export data from a grid to an excel file instead of that component.
what do you suggest me to do?
The Exporter is WYSIWYG - it tries to make the export look just like the grid on the screen. Either Excel is interpreting something incorrectly or a style is perhaps interfering. Please send me a sample and I'll take a look. Something must be changing the look and feel of the worksheet, perhaps a style. Normally you have to opt into the exporter's events to make changes to the Excel file.