hodzung / excellibrary

Automatically exported from code.google.com/p/excellibrary
1 stars 0 forks source link

CellStyle #72

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I set CellStyle with red color but output excel file with white cells.

 public void SaveExcel(String filePath, DataSet dataset) 
        {
        if (dataset.Tables.Count == 0)
                throw new ArgumentException("DataSet needs to have at least one DataTable", "dataset");

            Workbook workbook = new Workbook();
            foreach (DataTable dt in dataset.Tables)
            {
                Worksheet worksheet = new Worksheet(dt.TableName);
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    // Add column header
                    worksheet.Cells[0, i] = new Cell(dt.Columns[i].ColumnName);
                    if (dt.Columns[i].Caption == TestColumn)
                    {
                        worksheet.Cells[0, i].Style = new CellStyle() { BackColor = System.Drawing.Color.Red };

                    }

                    // Populate row data
                    for (int j = 0; j < dt.Rows.Count; j++)
                    {
                        worksheet.Cells[j + 1, i] = new Cell(dt.Rows[j][i].ToString()) { Style = new CellStyle() { BackColor = System.Drawing.Color.Yellow } };
                    }
                }
                workbook.Worksheets.Add(worksheet);
            }
            workbook.Save(filePath);

        }

Original issue reported on code.google.com by marinazh...@gmail.com on 10 Oct 2010 at 12:26

GoogleCodeExporter commented 9 years ago
    for (int j = 0; j < dt.Rows.Count; j++)
                    {
                        var cell = new Cell(dt.Rows[j][i].ToString());
                        var cellStyle = new CellStyle();
                        cellStyle.BackColor  = new ColorPalette().Palette[0];
                        cell.Style = cellStyle;
                        worksheet.Cells[j + 1, i] = cell;
                    }

With color palette the same bug 

Original comment by marinazh...@gmail.com on 10 Oct 2010 at 12:35

GoogleCodeExporter commented 9 years ago
I cant see the CellStyle at all. I am using the dll version of the ExcelLibrary.

Original comment by TonyJose...@gmail.com on 9 Nov 2010 at 3:28

GoogleCodeExporter commented 9 years ago
any fix for the above issue (cell style) ... also please let me know if there 
is option to set borders

Original comment by prakash....@gmail.com on 3 Mar 2011 at 4:48

GoogleCodeExporter commented 9 years ago
I am using the DLL from 4/14/2011 and changing the BackColor of the cell is 
still not being saved to the file.

Original comment by jeffbr...@gmail.com on 1 Jun 2011 at 4:08

GoogleCodeExporter commented 9 years ago
Same problem for me

Original comment by jeromewi...@gmail.com on 28 Jul 2011 at 3:12

GoogleCodeExporter commented 9 years ago
The problem still exists.

Original comment by mariater...@gmail.com on 12 Jan 2012 at 5:31

GoogleCodeExporter commented 9 years ago
I would like to get the fix for this please. Thanks!

This has potential!!

Original comment by marlons...@gmail.com on 26 Feb 2012 at 4:59