[英]C# Few issues regarding SpreadsheetLight usage
1)我正在使用SpreadsheetLight庫,我想知道如何設置行的顏色為紅色或黃色?
2)還告訴我如何設置顏色范圍明智說Range["A1:Z1"] ?
3)如何明智地應用格式單元格范圍?
sheet.Range[DataRangeCoordinate].NumberFormat = "#,##0.000;[Red](-#,##0.000);#,##0.000";
上面的代碼與 devexpress 電子表格相關。 那么在使用 SpreadsheetLight 時如何做同樣的事情呢?
4) 如何在 For 循環中迭代所有單元格值?
當我使用 dev express 電子表格網格時,我使用以下代碼設置后退和前景色
sheet.Range["A1:Z1"].Font.Color = Color.IndianRed;
sheet.Range["A1:Z1"].Fill.BackgroundColor = Color.LightGray;
sheet.Range["A1:Z1"].Style.Font.Bold = true;
5) 如何為所有列設置列寬?
6) 如何設置自動調整所有列?
7) 當我嘗試創建CreateStyle
我的代碼時出現錯誤,如下所示
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Spreadsheet;
using SpreadsheetLight;
SLStyle style1 = sl.CreateStyle();
style.Fill.SetPattern(PatternValues.Solid, System.Drawing.Color.IndianRed, System.Drawing.Color.LightGray);
sl.SetCellStyle(1, 0, style1);
我已經從 Nuget 安裝了最新版本的 OpenXml。
請幫助我提供代碼示例。 謝謝
您是否檢查了電子表格燈的開發人員文檔?
他們在這里提供了一個例子: http : //spreadsheetlight.com/downloads/samplecode/StyleRowColumnCell.cs
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.