After exporting grid to Excel, if user copies the sheet into a new workbook the formatting changes and makes the information harder to read. Please see the "before" and "after" in the attachment. I am using Office 2007.
Can you please let me know why this is happening?
Regards,
Mayank
reproduced in 10.3.20103.1000 version of Infragistics3.Win.UltraWinGrid.ExcelExport.v10.3, could you please check?
Hi Mike,
Thanks for the explanation and solution.
On some googling, I found out that we can copy custom color palette from one Excel Workbook to another. The steps are:
Excel 2003:
Excel 2007:
While this may not be an elegant solution as the steps have to be repeated every time user copy/pastes, this may be of some help to others facing the same problem.
Thanks for all your help.
Hi Mayank,
Thanks for the sample. I do see the problem you are encountering. What happens is - by default, the Exporter uses a custom palette based on the colors you are using in your grid. When you copy from one workbook to another, Excel doesn't copy the palette along with it. So there's nothing we can do about that.
So to get around something like this, what you can do is set the DefaultWorkbookPaletteMode:
excelExporter.DefaultWorkbookPaletteMode = Infragistics.Excel.WorkbookPaletteMode.StandardPalette;
This tells the exporter not to use a custom palette, but to just use the standard palette colors in Excel. So it will look at the color of the grid on-screen and try to find the closest matching color in Excel's palette. This means that the Excel export might not exactly match the grid on the screen in terms of colors. But copying and pasting from Excel to another workbook will work just fine.
PFA the requested sample project. Generate the excel file and try to copy paste it into another workbook to reproduce the bug.
Well, if you can provide a small sample project that creates an Excel file where this problem occurs, I can run it with the latest service release and see if I can duplicate the issue.
That way we will know if this is a bug that is already fixed (in which case you can get the service release) or a bug that we need to fix. :)