简体   繁体   中英

C# Few issues regarding SpreadsheetLight usage

1) i am using SpreadsheetLight library and i like to know how could i set row's color red or yellow ?

2) also tell me how could i set color range wise say Range["A1:Z1"] ?

3) how to apply format cell range wise ?

sheet.Range[DataRangeCoordinate].NumberFormat = "#,##0.000;[Red](-#,##0.000);#,##0.000";

the above code is devexpress spreadsheet related. so how to do the same when working with SpreadsheetLight ?

4) how to iterate in all cell value with in For loop ?

when i am using dev express spreadsheet grid then i use below code to set back & fore color

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) How to set column width for all column ?

6) How to set autofit all columns ?

7) i am getting error when i am trying to create CreateStyle my code as follows

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);

i have installed latest version of OpenXml from Nuget.

please help me with code sample. thanks

Did you check the developer documentation of spreadsheetlight?

They provide an example here: http://spreadsheetlight.com/downloads/samplecode/StyleRowColumnCell.cs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM