Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
Some questions about Infragistics.Excel and the document format
posted

Hi all, I have two cuestions today:

1)  How can I set text style to the exported cells with Infragistics.Excel?

For example, when we must write the headers with bold text...

 

2) How can I set background and foreground color to the exported cells?

I have tried the following:

Workbook Wb = new Workbook(WorkbookPaletteMode.StandardPalette);

Worksheet Ws = Wb.Add("WorksheetName"); //Adding new worksheet to the workbook

for (int r = 0; r < 5; r++) {

for (int c = 0; c < 5; c++) {

Ws.Rows[r].Cells[c].CellFormat.FillPattern = FillPatternStyle.Solid;

Ws.Rows[r].Cells[c].CellFormat.FillPatternBackgroundColor = Color.White; //throws exception

Ws.Rows[r].Cells[c].CellFormat.FillPatternForegroundColor = Color.Black;

}

}

---- > Exception: "Index was outside the bounds of the array." relative to Infragistics.Excel.WorkbookColorCollection ... ¿Any ideas?

 

Thanks!

Jacobo.

Parents
No Data
Reply
  • 469350
    Offline posted

    JHH said:
    1)  How can I set text style to the exported cells with Infragistics.Excel?

     

    Ws.Rows[r].Cells[c].CellFormat.Font.Bold = ExcelDefaultableBoolean.True;

    JHH said:
    2) How can I set background and foreground color to the exported cells?

    I tried out your code and it works fine for me, I get no exception. What version of the assemblies are you using? Do you have the latest Hot Fix? Can you post the complete call stack of the error? 

     

     

Children