SpreadsheetLight: How to set foreground/background color & other issues

  • Thread starter Thread starter Sudip_inn
  • Start date Start date
S

Sudip_inn

Guest
1) i am using SpreadsheetLight library and i like to know how could i set row 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

Continue reading...
 
Back
Top