Excel 2003 및 이전 버전의 Excel에서는 56 색 팔레트로 제한됩니다.
Excel 2007에는 테마 색뿐만 아니라 24 비트 색도 지원됩니다. Excel 2007에서는이 추가 색 정보가 포함되어 있고 Excel 2003에서 읽을 수있는 xls 통합 문서를 작성할 수 있지만 Excel 2003은 여전히 56 색 팔레트로 제한됩니다. Excel 2007에서는 이러한 통합 문서를로드하고 정확한 색상을 표시 할 수 있습니다.
은 Excel 2007에서와 마찬가지로 새로운 24 비트 색 및 테마 색뿐만 아니라 이전 팔레트 색인 색을 지원합니다. 스프레드 시트 기어를 사용하여 24 비트 색상의 통합 문서를 만들면 Excel 2007에서 올바르게 표시되거나 팔레트가 수정되어 Excel 2007 및 Excel 2003에서 올바르게 표시됩니다. 아래 두 가지 예가 있습니다.
무료 시험판 here을 다운로드하여 직접 시도 할 수 있습니다.
면책 조항 :
// Create a new empty workbook with one worksheet.
IWorkbook workbook = Factory.GetWorkbook();
// Get the worksheet and change it's name to "Person".
IWorksheet worksheet = workbook.Worksheets[0];
worksheet.Name = "Colors";
// Put "Hello World!" into A1.
IRange a1 = worksheet.Cells["A1"];
a1.Value = "Hello World!";
a1.Font.Color = System.Drawing.Color.FromArgb(0x8C, 0xBE, 0x50);
// Save the workbook as xls (Excel 97-2003/Biff8) with default palette.
//
// This workbook will display the exact color in Excel 2007 and
// SpreadsheetGear 2009, but will only display the closest available
// palette indexed color in Excel 2003.
workbook.SaveAs(@"C:\tmp\GreenDefaultPalette.xls", FileFormat.Excel8);
// Save as xlsx/Open XML which will also display the exact color.
workbook.SaveAs(@"C:\tmp\GreenDefaultPalette.xlsx", FileFormat.OpenXMLWorkbook);
// Now, modify the palette and save. This workbook will display the exact
// color in Excel 2003 as well as in SpreadsheetGear 2009 and Excel 2007.
//
// Note that modifying the palette will change the color of any cells which
// already reference this palette indexed color - so be careful if you are
// modifying pre-existing workbooks.
workbook.Colors[0] = a1.Font.Color;
workbook.SaveAs(@"C:\tmp\GreenModifiedPalette.xls", FileFormat.Excel8);
: 내가하는 SpreadsheetGear LLC는
다음 샘플 코드입니다 소유