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
2745
Export to excel changes column width
posted

Hello!

I am using the latest version of the components (2021.2) and when I am exporting to Excel from an UltraGrid (WinForms) via the UltraGridExcelExporter, the column widths in the Excel file are changed.

My exportformattingoptions are set to none, and I am exporting to an existing excel file with already set column widths that we don't want to change.

Can you advice?

/Henrik

Parents Reply
  • 1700
    Verified Answer
    Offline posted in reply to Henrik Bengtsson

    Hello Henrik,

    If you only want to export the grid data from specific rowIndex and colIndex, then I believe that the Excel Engine would be a better option than the UltraGridExcelExporter. With it you would be able to load the specific template file and preserve its format as well as entering the data from the grid in the cells of the template file.

    I am attaching a small sample that demonstrates what I have explained above, for template I am using an excel file with specified widths of the columns as well as a background color for the headers. When the user presses the “Load Excel File and Export Specific Data” button the template file is loaded by the Excel Engine, the required data is written and then the file is saved under a different name in order to compare if the formatting of the file is preserved successfully. Along with the sample I am attaching the “template” that I have used as well as the resulting excel file.

    Please test the sample on your side and let me know if you have any questions or converns.

    Regards,
    Ivan Kitanov

    ExportGridWithMultipleRows.zip

Children