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
Hi Mayank,
I seem to recall an issue like this being fixed a while ago. What version of the controls are you using? Do you have the latest service release?
How to get the latest service release - Infragistics Community
Hi Mike,
Thanks for the quick reply.
I am using Infragistics version 9.1.20091.2029. Also, this issue occurs only when I am using Office 2007. I faced no issue when I did copy/paste on Excel 2003.
On a separate context, as our application will be going into production shortly, it becomes difficult for us to keep updating the Infragistics DLLs as the entire application has to be retested.
Please suggest some solution.
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. :)
reproduced in 10.3.20103.1000 version of Infragistics3.Win.UltraWinGrid.ExcelExport.v10.3, could you please check?
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.
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.