Spread for ASP.NET 12 Product Documentation
Colors Exported
Spread for ASP.NET 12 Product Documentation > Import and Export Reference > Excel-Formatted File Export > Colors Exported

When exporting to Excel 2007 (Office Open XML), no loss of color information occurs. Spread is more constrained when exporting to Excel (BIFF8). When exporting to Excel (BIFF8), some changes to colors may occur.

Spread supports the creation of custom color palettes (BIFF record PALETTE) when exporting documents to Excel 2003 (.XLS) using the SaveExcel method. For example:

Code
Copy Code
fpSpread.SaveExcel(“outfile.xls”)

Excel 2003 supports a 56-color palette, so this produces a custom palette for Spread if 56 or fewer colors are set within the Spread component. If the Spread component has greater than 56 colors set, by default the component uses the default Excel 2003 (.XLS) color palette and uses a color approximation algorithm to determine the best default color to use for each color set in the Spread component. As an option for the condition where greater than 56 colors are set in the Spread component, there is an ExcelSaveFlags enumeration added to allow you to choose to use the custom palette as the basis for the approximation algorithm. The following code example uses the enumeration:

Code
Copy Code
fpSpread.SaveExcel(“outfile.xls”, 
FarPoint.Excel.ExcelSaveFlags.UseCustomPaletteForColorApproximations)

If you use the UseCustomPaletteForColorApproximations setting, the custom palette is created and saved to the exported Excel 2003 (.XLS) document and all color references in the document refer to the custom palette.