Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
475
export data to a formated excel?
posted

is there any way to export the data from infragistics ultraweb grid to a specific excel file which is havinng some formats?

 say i have my template in \Templates folder in my server. (i.e \Templates\UserTemplate.xls) i want to write my data from the webgrid to this excel. our server may not have excel installed so i am using infragistics.excel.

thanks

arun.k.s

atmy@chevron.com

 

Parents
  • 4960
    Verified Answer
    posted

    You can try loading your own .XLS workbook into an Infragistics.Excel Workbook object using its Load method.  If there is anything the Workbook object doesn't recognize, it will try to preserve it as-is for when you Save the workbook back to a file or for transmission to the end user.

    You can also direct WebGridExcelExporter to begin exporting at a specific position on a Worksheet by setting its ExcelStartRow and ExcelStartColumn properties.  Left to its own designs, at this point WebGridExcelExporter will start writing out your WebGrid in rectangular fashion with the specified cell as the top, left corner of a rectangular region.  If there is any formatting underneath where the exporter is writing, it will probably be overwritten.  If even further fine grained control is necessary, there are a number of events you can handle (for example, to put the first 100 rows on Sheet1, the second 100 rows on Sheet2, etc.) 

    So this should work relatively easily if your template has a nice rectangular region in it for where you want the WebGrid to be exported, and all the customizations are around the margins or before the start of the exported WebGrid at the top of the Worksheet.  As your template worksheet grows more complex, the more likely you're going to need to direct the export so it retains your areas of custom formatting.

    One thing WebGridExcelExporter will do is resize the Worksheet columns where it exports cell values because it tries to guarantee the column is at least as wide as the widest cell value.  If you have a column formatted to a specific width in your template for some reason, then this behavior may actually lead that column width to become narrowed.  You can stretch the columns back to your desired width (measured in twips) in the EndExport event.

    https://ko.infragistics.com/help/aspnet/web-webexcelexporter

Reply Children