Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all 1877 articles
Browse latest View live

Created Unassigned: Deleting row from table resizes table incorrectly [9418]

$
0
0
I am greatly enjoying ClosedXml but have run into an issue when deleting a row from a table.

The issue seems to be that while the row indeed is deleted, the last (undeleted) row of the table ends up *outside* the table. That is, if I have a table with 5 rows and then delete row 2 then the resulting table has 3 rows (and not 4) with one bottom row ending out outside the table.

I have attached a simple repro which hopefully shows the issue.

Thanks for a great library and for any assistance!

Henrik

Created Unassigned: When trying to retrieve value of a formula, ClosedXML throws 'Identifier Expected' Exception [9419]

$
0
0
I am using ClosedXML 0.76.0 to build my application, which handles Excel files.

At one moment, I populate an Excel file with formulas. So far, so good.

The user then gets this file and fills in values concerning the business.

At this moment, I read the calculated values and populate another larger Excel file.

The problem is that when I try reading cells with fomulas, ClosedXML throws "Identifier Expected" exception.

My code is just as follows:

```
1 string formula = row.Cell(i).FormulaA1;

2 object result = workbook.Evaluate(formula);

3 decimal sum += Convert.ToDecimal(result, CultureInfo.InvariantCulture);

```
The exception happens on line 2.

The formula is likely to be _'Indice'!D$5*'URCTS - 210'!G5_ or similar.

Edited Unassigned: When trying to retrieve value of a formula, ClosedXML throws 'Identifier Expected' Exception [9419]

$
0
0
I am using ClosedXML 0.76.0 to build my application, which handles Excel files.

At one moment, I populate an Excel file with formulas. So far, so good.

The user then gets this file and fills in values concerning the business.

At this moment, I read calculated values and populate another larger Excel file.

The problem is that when I try reading cells with fomulas, ClosedXML throws "Identifier Expected" exception.

My code is just as follows:

```
1 string formula = row.Cell(i).FormulaA1;

2 object result = workbook.Evaluate(formula);

3 decimal sum += Convert.ToDecimal(result, CultureInfo.InvariantCulture);

```
The exception happens on line 2.

The formula is likely to be _'Indice'!D$5*'URCTS - 210'!G5_ or similar.

Edited Unassigned: When trying to retrieve value of a formula, ClosedXML throws 'Identifier Expected' Exception [9419]

$
0
0
I am using ClosedXML 0.76.0 to build my application, which handles Excel files.

At one moment, I populate an Excel file with formulas. So far, so good.

The user then gets this file and fills in values concerning the business.

At this moment, I read calculated values and populate another larger Excel file.

The problem is that when I try reading cells with fomulas, ClosedXML throws "Identifier Expected" exception.

My code is just as follows:

```
1 string formula = row.Cell(i).FormulaA1;

2 object result = workbook.Evaluate(formula);

3 decimal sum += Convert.ToDecimal(result, CultureInfo.InvariantCulture);

```
The exception happens on line 2.

The formula is likely to be _'Indice'!D$5*'URCTS - 210'!G5_ or similar. There are single quotes delimiting worksheet names containing spaces.

Edited Unassigned: When trying to retrieve value of a formula, ClosedXML throws 'Identifier Expected' Exception [9419]

$
0
0
I am using ClosedXML 0.76.0 to build my application, which handles Excel files.

At one moment, I populate an Excel file with formulas. So far, so good.

The user then gets this file and fills in values concerning the business.

At this moment, I read calculated values and populate another larger Excel file.

The problem is that when I try reading cells with fomulas, ClosedXML throws "Identifier Expected" exception.

My code is just as follows:

```
1 string formula = row.Cell(i).FormulaA1;

2 object result = workbook.Evaluate(formula);

3 sum += Convert.ToDecimal(result, CultureInfo.InvariantCulture);

```
The exception happens on line 2.

The formula is likely to be _'Indice'!D$5*'URCTS - 210'!G5_ or similar. There are single quotes delimiting worksheet names containing spaces.

Commented Unassigned: When trying to retrieve value of a formula, ClosedXML throws 'Identifier Expected' Exception [9419]

$
0
0
I am using ClosedXML 0.76.0 to build my application, which handles Excel files.

At one moment, I populate an Excel file with formulas. So far, so good.

The user then gets this file and fills in values concerning the business.

At this moment, I read calculated values and populate another larger Excel file.

The problem is that when I try reading cells with fomulas, ClosedXML throws "Identifier Expected" exception.

My code is just as follows:

```
1 string formula = row.Cell(i).FormulaA1;

2 object result = workbook.Evaluate(formula);

3 sum += Convert.ToDecimal(result, CultureInfo.InvariantCulture);

```
The exception happens on line 2.

The formula is likely to be _'Indice'!D$5*'URCTS - 210'!G5_ or similar. There are single quotes delimiting worksheet names containing spaces.
Comments: The stack trace is as follows: ``` em ClosedXML.Excel.CalcEngine.CalcEngine.Throw(String msg) em ClosedXML.Excel.CalcEngine.CalcEngine.GetToken() em ClosedXML.Excel.CalcEngine.CalcEngine.ParseMulDiv() em ClosedXML.Excel.CalcEngine.CalcEngine.ParseAddSub() em ClosedXML.Excel.CalcEngine.CalcEngine.ParseCompare() em ClosedXML.Excel.CalcEngine.CalcEngine.ParseExpression() em ClosedXML.Excel.CalcEngine.CalcEngine.Parse(String expression) em ClosedXML.Excel.CalcEngine.ExpressionCache.get_Item(String expression) em ClosedXML.Excel.CalcEngine.CalcEngine.Evaluate(String expression) em ClosedXML.Excel.XLWorkbook.Evaluate(String expression) em Siswebe.BLL.Business.PlanilhaGeral.GetDataTable(XLWorkbook wbEntrada) na d:\Projetos\ProcessosSDI\vBase\Siswebe\Siswebe.BLL\Business\PlanilhaGeral.cs:linha 377 em Siswebe.BLL.Business.PlanilhaGeral.TransferirDadosProdutoQuimico(WorkbookPlanilhaGeralDTO dto, XLWorkbook wbPlanilhaGeral) na d:\Projetos\ProcessosSDI\vBase\Siswebe\Siswebe.BLL\Business\PlanilhaGeral.cs:linha 307 em Siswebe.BLL.Business.PlanilhaGeral.TransferirDados(WorkbookPlanilhaGeralDTO dto, XLWorkbook wbPlanilhaGeral) na d:\Projetos\ProcessosSDI\vBase\Siswebe\Siswebe.BLL\Business\PlanilhaGeral.cs:linha 410 em Siswebe.BLL.Business.PlanilhaGeral.GerarPlanilhaGeral(Stream outputStream) na d:\Projetos\ProcessosSDI\vBase\Siswebe\Siswebe.BLL\Business\PlanilhaGeral.cs:linha 242 em Siswebe.GestaoAPE.EnviarPlanilhaGeral() na d:\Projetos\ProcessosSDI\vBase\Siswebe\Siswebe\GestaoAPE.aspx.cs:linha 356 em Siswebe.GestaoAPE.btnDownloadGeral_Click(Object sender, EventArgs e) na d:\Projetos\ProcessosSDI\vBase\Siswebe\Siswebe\GestaoAPE.aspx.cs:linha 493 em System.Web.UI.WebControls.Button.OnClick(EventArgs e) em System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) em System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) em System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) em System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) em System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ``` I tried changing line 2 above by simply ``` 2 object result = row.Cell(i).Value; ``` but the exception thrown is the same.

Commented Unassigned: Formula evaluation fails with single quotes in worksheet name [9402]

$
0
0
This seems rather fundamental, but after an extensive search I can't seem to find anything related to a problem I'm having.

I'm getting a "Identifier Expected" error when trying to evaluate a formula with the worksheet name in single quotes and containing spaces:
```
string test = "IF('Income & Expense'!H34 <> \"\", 'Income & Expense'!H34, IF('Income & Expense'!H35 <> \"\", 'Income & Expense'!H35, \"\"))";
var val = multiWorkbook.Evaluate(test);
```
I simplified this to:
```
string test = "'Income & Expense'!H34";
```
and get the same "Identifier Expected" error. Removing the single quotes I get "There isn't a worksheet named Expense".

Is there another way to specify spaces in worksheet names? Or is something else going on?
Comments: I am having the same problem with my web application running ClosedXML. Is there possibly any change for this bug to be fixed any time soon?

Commented Unassigned: When trying to retrieve value of a formula, ClosedXML throws 'Identifier Expected' Exception [9419]

$
0
0
I am using ClosedXML 0.76.0 to build my application, which handles Excel files.

At one moment, I populate an Excel file with formulas. So far, so good.

The user then gets this file and fills in values concerning the business.

At this moment, I read calculated values and populate another larger Excel file.

The problem is that when I try reading cells with fomulas, ClosedXML throws "Identifier Expected" exception.

My code is just as follows:

```
1 string formula = row.Cell(i).FormulaA1;

2 object result = workbook.Evaluate(formula);

3 sum += Convert.ToDecimal(result, CultureInfo.InvariantCulture);

```
The exception happens on line 2.

The formula is likely to be _'Indice'!D$5*'URCTS - 210'!G5_ or similar. There are single quotes delimiting worksheet names containing spaces.
Comments: This issue is a duplicate of [https://closedxml.codeplex.com/workitem/9402](Item 9402).

Commented Unassigned: When trying to retrieve value of a formula, ClosedXML throws 'Identifier Expected' Exception [9419]

$
0
0
I am using ClosedXML 0.76.0 to build my application, which handles Excel files.

At one moment, I populate an Excel file with formulas. So far, so good.

The user then gets this file and fills in values concerning the business.

At this moment, I read calculated values and populate another larger Excel file.

The problem is that when I try reading cells with fomulas, ClosedXML throws "Identifier Expected" exception.

My code is just as follows:

```
1 string formula = row.Cell(i).FormulaA1;

2 object result = workbook.Evaluate(formula);

3 sum += Convert.ToDecimal(result, CultureInfo.InvariantCulture);

```
The exception happens on line 2.

The formula is likely to be _'Indice'!D$5*'URCTS - 210'!G5_ or similar. There are single quotes delimiting worksheet names containing spaces.
Comments: [Item 9402](https://closedxml.codeplex.com/workitem/9402)

New Post: IntegerExtension.ToStringLookup not threadsafe?

$
0
0
I get a similar error:
System.ArgumentException: An item with the same key has already been added.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at ClosedXML.Excel.XLAddress.GetTrimmedAddress()
at ClosedXML.Excel.XLWorkbook.GenerateWorksheetPartContent(WorksheetPart worksheetPart, XLWorksheet xlWorksheet, SaveContext context)
at ClosedXML.Excel.XLWorkbook.CreateParts(SpreadsheetDocument document)
at ClosedXML.Excel.XLWorkbook.CreatePackage(String filePath)

I'm using ClosedXML in a web service and the error occurs when there are concurrent calls using the library in separate threads. So it sounds like ClosedXML is not threadsafe but I'm hoping that someone can confirm and if it's possible to make changes to make it threadsafe.

Created Unassigned: Error when openning of file [9420]

$
0
0
Hello.

I have a trouble with openning one specific excel file (in attachment)

When I try to open it:
```
XLWorkbook workbook = new XLWorkbook(path);
```

I have an error:
```
Exception:Thrown: "Value was either too large or too small for an Int32." (System.OverflowException)
A System.OverflowException was thrown: "Value was either too large or too small for an Int32."
```

In stack trace last metod was "LoadPageSetup"
```
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at ClosedXML.Excel.XLWorkbook.LoadPageSetup(PageSetup pageSetup, XLWorksheet ws)
at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName)
at ClosedXML.Excel.XLWorkbook.Load(String file)
at ClosedXML.Excel.XLWorkbook..ctor(String file, XLEventTracking eventTracking)
at ClosedXML.Excel.XLWorkbook..ctor(String file)
```


Commented Unassigned: Error when openning of file [9420]

$
0
0
Hello.

I have a trouble with openning one specific excel file (in attachment)

When I try to open it:
```
XLWorkbook workbook = new XLWorkbook(path);
```

I have an error:
```
Exception:Thrown: "Value was either too large or too small for an Int32." (System.OverflowException)
A System.OverflowException was thrown: "Value was either too large or too small for an Int32."
```

In stack trace last metod was "LoadPageSetup"
```
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at ClosedXML.Excel.XLWorkbook.LoadPageSetup(PageSetup pageSetup, XLWorksheet ws)
at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName)
at ClosedXML.Excel.XLWorkbook.Load(String file)
at ClosedXML.Excel.XLWorkbook..ctor(String file, XLEventTracking eventTracking)
at ClosedXML.Excel.XLWorkbook..ctor(String file)
```


Comments: Solved. This problem was actual for version 0.69 In current starble version 0.76 problem was gone.

New Post: Export as DataTable

$
0
0
I'm new at ClosedXML and was wondering if there is an easy way to export or save as a datatable or do I just need to loop the rows and columns? There is a great way to load a datatable and I was wondering if it also works in reverse.

Added Information:
I just saw a post about 3 years back and it states to just loop. If noting has changed I go with that.

Thanks

Commented Unassigned: System.OutOfMemoryException in v0.68.0.10, regression? [8808]

$
0
0
Hello,

In order to improve the speed of reading/writing of Excel files, I have recently updated ClosedXML from v0.64.0.0 to v0.68.0.10.

The kind of Excel file that I deal with is a big file, embedding a lot of VBA code ; I use it as a template, filling only 2 sheets with raw data (number or string, no formula).

The VBA developper improve this file continuously, for some files there was a huge speed difference, but we have arrived in a point where :

- With v0.64.0.0, we have the good results, but it is very slow
- With v0.68.0.10, the memory is increasing and then a "System.OutOfMemoryException" is thrown.

The exception is thrown in the code below

```
public XLWorkbook OpenExcel(MemoryStream xlsStream)
{
return new XLWorkbook(xlsStream, XLEventTracking.Disabled); //RR 13/06/2013 Turning off events
}
```

with v0.64.0.0 the memory is not increasing a lot during this operation (quite stable), but with v0.68.0.10 the memory used is increasing a lot (1 more GB) and then the exception occured.

I try to turn of the events, but it doesn't change anything.

Does anyone else had this issue before?

Thank you very much for your help.

Regards,
Renaud
Comments: I am having the out of memory issue, with reading an excel file with 50k items in it, as well. You can see the file attached. Let me know if I can provide more, useful information

Commented Unassigned: System.OutOfMemoryException in v0.68.0.10, regression? [8808]

$
0
0
Hello,

In order to improve the speed of reading/writing of Excel files, I have recently updated ClosedXML from v0.64.0.0 to v0.68.0.10.

The kind of Excel file that I deal with is a big file, embedding a lot of VBA code ; I use it as a template, filling only 2 sheets with raw data (number or string, no formula).

The VBA developper improve this file continuously, for some files there was a huge speed difference, but we have arrived in a point where :

- With v0.64.0.0, we have the good results, but it is very slow
- With v0.68.0.10, the memory is increasing and then a "System.OutOfMemoryException" is thrown.

The exception is thrown in the code below

```
public XLWorkbook OpenExcel(MemoryStream xlsStream)
{
return new XLWorkbook(xlsStream, XLEventTracking.Disabled); //RR 13/06/2013 Turning off events
}
```

with v0.64.0.0 the memory is not increasing a lot during this operation (quite stable), but with v0.68.0.10 the memory used is increasing a lot (1 more GB) and then the exception occured.

I try to turn of the events, but it doesn't change anything.

Does anyone else had this issue before?

Thank you very much for your help.

Regards,
Renaud
Comments: Forgot to mention the version I am using is 0.76

New Post: Loading SSRS Excel spreadsheet throws Object reference not set error

$
0
0
Same here using EXCELOPENXML.

It looks like SSRS is putting invalid characts into the XML. It may be related to this EPPlus thread: https://epplus.codeplex.com/workitem/14948

Haven't found a way around yet.

Remember: EXCELOPENXML produces a openXML documents instead of EXCELs old binary format. XLS != XLSX

Closed Unassigned: Error when openning of file [9420]

$
0
0
Hello.

I have a trouble with openning one specific excel file (in attachment)

When I try to open it:
```
XLWorkbook workbook = new XLWorkbook(path);
```

I have an error:
```
Exception:Thrown: "Value was either too large or too small for an Int32." (System.OverflowException)
A System.OverflowException was thrown: "Value was either too large or too small for an Int32."
```

In stack trace last metod was "LoadPageSetup"
```
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at ClosedXML.Excel.XLWorkbook.LoadPageSetup(PageSetup pageSetup, XLWorksheet ws)
at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName)
at ClosedXML.Excel.XLWorkbook.Load(String file)
at ClosedXML.Excel.XLWorkbook..ctor(String file, XLEventTracking eventTracking)
at ClosedXML.Excel.XLWorkbook..ctor(String file)
```


Comments: Reporter states issue is fixed.

Created Unassigned: While Writing to Excel file its throwing an error "'.', hexadecimal value 0x00, is an invalid character." [9421]

$
0
0
Hi All,

While Writing to Excel File using the ClosedXML facing an issue. Above is the error mentioned into caption which I am getting.

Have attached the Excel File which I am trying to Write by passing the DataSet.

Please Reply ASAP.

Thanks,
Samir.

Commented Unassigned: While Writing to Excel file its throwing an error "'.', hexadecimal value 0x00, is an invalid character." [9421]

$
0
0
Hi All,

While Writing to Excel File using the ClosedXML facing an issue. Above is the error mentioned into caption which I am getting.

Have attached the Excel File which I am trying to Write by passing the DataSet.

Please Reply ASAP.

Thanks,
Samir.
Comments: Here is the Screen Shot of an error.

New Post: AdjustToContent is very slow

$
0
0
@DeLeon, can you elaborate on the threading issues?
I can't find no threading in ClosedXml.

I have the same issue with AdjustToContents beeing slow.
We generate a quite large excel sheet. ~20k rows and 50 columns.
For most of our columns the data is quite uniform and adjusting only the top few 100 would be enough, but some of our columns are quite sparse. Mostly empty, but some rows have long strings. If we don't get any strings in the top x rows the width adjustment of that column would be way of.

I'm considering to invest some time to create a pull request with a few performance improvements in this area.
I have a few options that I'm considering.
  1. Move the creation of the graphics object from GraphicsUtils.MeasureString to XLColumn.AdjustToContents and pass the graphics along with the font cache
  2. Create a dictionary from <IXLFontBase, string> to SizeF to cache the size of strings to speed up adjustment when there are lots of duplicates.
  3. Sort the columns by simple string character count and measure the top x% to make it more likely to find the longest columns.
However before I start out I'm curios to hear about the threading issues to make sure I don't mess anything up.

By the way, I can't find any contributor guide lines. Anything special to think about more than to make sure the code looks tidy and the tests are green?
Viewing all 1877 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>