pearcefleming / excellibrary

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

Error with Dataset #97

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. When the dataset has null values in the any columns it crashed
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by arrozev...@gmail.com on 21 Jun 2011 at 4:11

GoogleCodeExporter commented 8 years ago
In DataSetHelper.CreateWorkbook, why not use this ?

     // Populate row data
     for (int j = 0; j < dt.Rows.Count; j++)
+    {
+        if (Convert.IsDBNull(dt.Rows[j][i]))
+           worksheet.Cells[j + 1, i] = new Cell(String.Empty);
+        else
            worksheet.Cells[j + 1, i] = new Cell(dt.Rows[j][i]);
+    }

Original comment by pagi...@gmail.com on 23 Jun 2011 at 5:16

GoogleCodeExporter commented 8 years ago
In addition to pagirre's change, you also have to change EncodeCell in 
WorkSheetEncoder. Add this case:

else if (Convert.IsDBNull(value))
            {
                LABELSST label = new LABELSST();
                label.SSTIndex = sharedResource.GetSSTIndex("");
                return label;
            }

Original comment by smdo...@gmail.com on 9 Aug 2011 at 9:39