I attach the sample project containing a excel sample file.
I attach the sample project containing a excel sample file.
MDeLeon,
Thanks you so much!!!
I'll be working to set the proper values in the cells.
A last question. How did you knew that the column has text values?
Regards,
I debugged the LoadCells method and it showed that the OpenXML file had strings.
ws.Column(3).Style.NumberFormat.Format = "$ #,##0.00";
ws.RangeUsed().Column(3).Style.NumberFormat.Format = "$ #,##0.00";
ws.Column(3).Column(2, ws.LastRowUsed().RowNumber()).Style.NumberFormat.Format = "$ #,##0.00";
ws.Range(2, 3, ws.LastRowUsed().RowNumber(), 3).Style.NumberFormat.Format = "$ #,##0.00";
I've also noticed issues with my project when deployed to Azure. Will try and to create a simple repro, but for now it's rendered ClosedXml usage completely useless, since the Excel report makes no sense with those arbitrary width.s
How about using the GDI as fallback? Please see if you can make a repro project...
XLWorkbook wb = new XLWorkbook();
foreach (DataTable dt in ds1.Tables)
{
if (dt.Rows.Count > 0)
wb.Worksheets.Add(dt, dt.Rows[0]["TITLE"].ToString());
}
Im using above code to add worksheet for each datatable in a dataset. I can't able to add the worksheet..Tables.First().AutoFilter.Enabled = false;
XLWorkbook wb = new XLWorkbook();
wb.Worksheets.First().Tables.First().ShowAutoFilter = false;
I got the result for first sheet. But for the other sheets i add it shows the dropdown...I have done some testing and have narrowed down the problem. Attached is the skeleton from my Excel file which calculates some values on sheet 2 and displays the result on sheet 1 (with a letter whose addresses I removed).
The result from sheet 2 (named "Anlage") is in cell C48.
On sheet 1 I have 3 cells which should show that result:
U27 (Formula: "=Anlage!C48")
U28 (Formula: "=ROUND(U27; 2)")
U29 (Formula: "=ROUND(Anlage!C48; 2)")
My program:
```
static void Main(string[] args)
{
XLWorkbook wb = new XLWorkbook(@"c:\temp\test3.xlsx");
IXLWorksheet ws1 = wb.Worksheet(1);
var value1 = ws1.Cell("U27").GetDouble();
var value2 = ws1.Cell("U28").GetDouble();
var value3 = ws1.Cell("U29").GetDouble();
}
```
VS2010 Debugger gives:
ws1.Cell("U27").Value 36718.308000000005 object {double}
ws1.Cell("U28").Value 0.0 object {double}
ws1.Cell("U29").Value 0.0 object {double}
Both formulas with "ROUND" do not give me the right results.
Could you take a look at this and explain it?
PS: I found out some other things before getting to the above step:
- ClosedXML does not like the Dollar sign in cell addresses (like A$10). This error gave the stack trace from my first comment.
- If a formula with a "SUM" includes empty cells, ClosedXML gives an exception, Excel itself treats them as zero and sums up the rest just fine. Could this be included in ClosedXML?