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

New Post: BUG Report - Cell with Accounting Format produces crash during String Table creation

$
0
0
MDeLeon wrote:
I didn't know that was possible. Create an issue and attach the file.
Oki doki - Will do.

Created Unassigned: Cell with Accounting Format produces crash during String Table creation [9376]

$
0
0

Se attached Excel document. It is currently being filled by manual data entry, which is a lot of work. The purpose of the application I am developing is to "clone" the "item 1" worksheet 'n' times (say, "item 2" to "item 36") and populate them from an XML file.

I found a bug in the __GetA1Column()__ method of the "__XLCell__" class.

The cell in question is formatted as "Accounting" and contains only a hyphen. The exception occurs when the following operation is attempted:

```
Int32.Parse("-");
```


Commented Unassigned: Cell with Accounting Format produces crash during String Table creation [9376]

$
0
0

Se attached Excel document. It is currently being filled by manual data entry, which is a lot of work. The purpose of the application I am developing is to "clone" the "item 1" worksheet 'n' times (say, "item 2" to "item 36") and populate them from an XML file.

I found a bug in the __GetA1Column()__ method of the "__XLCell__" class.

The cell in question is formatted as "Accounting" and contains only a hyphen. The exception occurs when the following operation is attempted:

```
Int32.Parse("-");
```


Comments: I can open and save it no problem. Is there anything else I have to do? ``` var wb = new XLWorkbook("One-Item.xlsx"); wb.SaveAs("One-Item2.xlsx"); ```

New Post: BUG Report - Cell with Accounting Format produces crash during String Table creation

$
0
0
I just realized that a previous CopyTo() is required in order to replicate the issue. Therefore. I edited my previous code containing post to reflect that fact.

Commented Unassigned: Cell with Accounting Format produces crash during String Table creation [9376]

$
0
0

Se attached Excel document. It is currently being filled by manual data entry, which is a lot of work. The purpose of the application I am developing is to "clone" the "item 1" worksheet 'n' times (say, "item 2" to "item 36") and populate them from an XML file.

I found a bug in the __GetA1Column()__ method of the "__XLCell__" class.

The cell in question is formatted as "Accounting" and contains only a hyphen. The exception occurs when the following operation is attempted:

```
Int32.Parse("-");
```


Comments: ``` XLWorkbook wb = new XLWorkbook(@"C:\Users\Ramon\My Documents\One-Item.xlsx"); IXLWorksheet ws = wb.Worksheet("item 1"); ws.CopyTo("item 2"); wb.Save(); ```

Commented Unassigned: Cell with Accounting Format produces crash during String Table creation [9376]

$
0
0

Se attached Excel document. It is currently being filled by manual data entry, which is a lot of work. The purpose of the application I am developing is to "clone" the "item 1" worksheet 'n' times (say, "item 2" to "item 36") and populate them from an XML file.

I found a bug in the __GetA1Column()__ method of the "__XLCell__" class.

The cell in question is formatted as "Accounting" and contains only a hyphen. The exception occurs when the following operation is attempted:

```
Int32.Parse("-");
```


Comments: I tried earlier to submit an additional screenshot that shows the code above plus the error message, but it seems that I can only submit text. The "ATTACH FILE (4 MB MAX)" feature is not working for me. It goes into an infinite loop. Next time, I will try with the Internet Explorer browser, instead of my usual Firefox....

New Post: BUG Report - Cell with Accounting Format produces crash during String Table creation

$
0
0
The problem is not the hyphen, it's seems that ClosedXML doesn't handle R1C1 notations of the kind R1C-

New Post: BUG Report - Cell with Accounting Format produces crash during String Table creation

$
0
0
That file is being processed hundreds of times a day, interactively and programmatically, and has no problem with:
  • Excel (all versions that accept *.xlsx)
  • OpenXML SDK
  • PowerTools
  • VSTO
Furthermore, the "item 1" sheet has no problem with ClosedXML. It is the 2nd. sheet, "item 2" (created by ClosedXML) the one that has problems.

Commented Unassigned: ClosedXML.Excel.IXLRow.Cell() returning wrong values [9375]

$
0
0
There is a bug in the ClosedXML.Excel.IXLRow.Cell() function.
I open a workbook and access a worksheet. The worksheet has only one row, so row.Rownumber returns 1.
I access the second row of the sheet with worksheet.Row(2). Now lastUsedRow-Rownumber is 2.
Accessing row.Cell(1) returns the value of the first row's first cell.

I think in this case an exception should be thrown like NoExistingCell instead of returning the value from a different row.

Documentation says "Gets the cell in the specified column.". But what about the specified row?
It does not say "returns the cell form he specified column in the last used row."

This bug makes comparing two Excel-Files really difficult.
Dont know the algorithm, but accessing a not existing cell shoult throw an error.

Attached the Excel-Rows and visual studio immediate-output.



Comments: So let me get this straight: I give closedxml some input, I try to access row two and get result from row 1. It seems to me that there are some unit test missing. As you may know: unittests give garbage imput, so you can check yor code. It seems to me I could write some unittests which would fail. Unittest fails = bug. I am an ISTQB certified tester, so I would say its a bug.

Commented Unassigned: ClosedXML.Excel.IXLRow.Cell() returning wrong values [9375]

$
0
0
There is a bug in the ClosedXML.Excel.IXLRow.Cell() function.
I open a workbook and access a worksheet. The worksheet has only one row, so row.Rownumber returns 1.
I access the second row of the sheet with worksheet.Row(2). Now lastUsedRow-Rownumber is 2.
Accessing row.Cell(1) returns the value of the first row's first cell.

I think in this case an exception should be thrown like NoExistingCell instead of returning the value from a different row.

Documentation says "Gets the cell in the specified column.". But what about the specified row?
It does not say "returns the cell form he specified column in the last used row."

This bug makes comparing two Excel-Files really difficult.
Dont know the algorithm, but accessing a not existing cell shoult throw an error.

Attached the Excel-Rows and visual studio immediate-output.



Comments: Should it throw an error when you try to create a range with an inverted address? Sure. Would that fix your problem? No If only there was a C# statement that allowed you to perform an action or not based on a condition...

New Post: Named Constants

$
0
0
Hello:

I have a fairly simple question. I am using ClosedXML in one of my projects. I just found out that ClosedXML can actually evaluate formulas after doing a simple search. What I have been doing until now is using Excel interop to evaluate the formulas using a PasteSpecial then using ClosedXML to read the results from a temporary sheet.

I am using very simple formulas, essentially Cell1 + Cell2 * Cell3, etc. and maybe some of the basic built in Excel functions. I know in the past that ClosedXML relied on the ValueCached property for values to be returned. I do not want to rely on this ValueCached, because 99% of the time it is not there. This does not seem to be an issue now.

My question is this: If I define a named constant, for example A4 = 1 and then in Excel define it as "constant", can ClosedXML then evaluate the formula using named constants? What about complex named constants (A4 + A5 + A6 / A1) = "constant)? Another cell then has the formula: B2 + B5 + constant. It seems as though ClosedXML is evaluating this, because if I then go get the cell using ClosedXML, the value is correct; HOWEVER, I notice that the "ValueCached" property is filled in with the same value. Is ClosedXML relying on value cached in this case that may or may not be there for some cells? Like I said, I do not want to rely on ValueCached. I want the formulas to be evaluate every time no matter what I throw at it. I realize not all Excel functions are supported; that is a given. Will ClosedXML evaluate every time with the simple formulas I am giving it?

If ClosedXML does not support this case, I understand and will subsequently stay away from named constants since I can just reference the actual cell. I just know that a bunch of the guys I work with happen to like named constants, because they are much easier to reference in multiple pages.

Thanks,

New Post: Named Constants

$
0
0
By constants, do you mean named ranges? If so then yes, you can include named ranges in your formulas and ClosedXML will evaluate them (as long as it uses known formulas). It will not use ValueCached.

Let me know if this answers your question...

New Post: Named Constants

$
0
0
I was looking at named ranges. I think that they are defined in a similar way. For a named range, you click on a range of cells and then in (usually) the top left, you can put the name. However, there is actually a button in Excel in formulas (for 2013) called "Define name" where you click a cell, press the button, and put a name in there.

I just took a look using the "name manager" in Excel and it looks like either if you use the define name button or use the box in the upper left, both constants show up exactly the same and can be used in the same way.

I guess that answers the question that ClosedXML therefore supports what I need. Im guessing the ValueCached is just showing up for whatever implementation defined reason; should not have to worry about my formulas not being evaluated.

Thanks,

Created Unassigned: Date/Number Formatting Issue using Worksheets.Add [9377]

$
0
0
I am using the workbook.worksheets.add method with a data table that I get from an Oracle DB using ODP.NET, but numbers and dates are always formatted as text. I end up running methods to fix this, but typically they require lots of memory to work.

code snippet:

XLWorkbook xlwb = new XLWorkbook();
IXLWorksheet ws = xlwb.Worksheets.Add(dt, "Worksheet Name");

Commented Unassigned: Freezing first row causes scroll wheel to no longer work. [9374]

$
0
0
When I freeze the first row, the scroll wheel no longer works. This is because the active pane is still set to the default of TopLeft (or TopRight, not sure which). So the scroll wheel is trying to scroll the frozen row. Open XML sets the active pane to bottom left or right to keep the scroll wheel working, with code like the following:

```
WorkbookPart wbp = doc.WorkbookPart;
WorksheetPart wsp = wbp.WorksheetParts.First();
SheetViews sheetviews = wsp.Worksheet.GetFirstChild<SheetViews>();
SheetView sv = sheetviews.GetFirstChild<SheetView>();
Selection selection = sv.GetFirstChild<Selection>();
selection.Pane = PaneValues.BottomLeft;
```

Is there a way to set the active pane to BottomLeft or BottomRight in ClosedXML?

Thanks!
Comments: Is there any chance of adding support to set the Pane? Is this not a problem for anyone who freezes a row?

Created Unassigned: Worksheet.PivotTables is always empty [9378]

$
0
0
My .xlsx file contains a Pivot Table. But I can't get access to it via `Worksheet.PivotTables` property.

This is my sample code:

```
using (var excel = new XLWorkbook(sourceFile, XLEventTracking.Enabled))
{
var pivots = excel.Worksheets.SelectMany(ws => ws.PivotTables).ToList();
// pivots.Count == 0
}

```
The version of the ClosedXML library is 0.75.0 (got from NuGet)

The example of .xml file is attached.


Created Unassigned: Compile error "Could not load file or assembly 'OpenXml' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) " [9379]

$
0
0
I dowmload OpenXml and ClosedXML for .Net 4.0 and refered to my web application. When I compile my application and I got the following error. What I missed?

Could not load file or assembly 'OpenXml' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Closed Unassigned: Compile error "Could not load file or assembly 'OpenXml' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) " [9379]

$
0
0
I dowmload OpenXml and ClosedXML for .Net 4.0 and refered to my web application. When I compile my application and I got the following error. What I missed?

Could not load file or assembly 'OpenXml' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Comments: Make sure your project is referencing the right DocumentFormat.OpenXml.dll (.Net 4.0+ uses OpenXML SDK 2.5).

Commented Unassigned: Compile error "Could not load file or assembly 'OpenXml' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) " [9379]

$
0
0
I dowmload OpenXml and ClosedXML for .Net 4.0 and refered to my web application. When I compile my application and I got the following error. What I missed?

Could not load file or assembly 'OpenXml' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Comments: Thanks for reply. Attached shows the property of the dll file that I referred. I did not install the SDK 2.5. Only downloaded and refrred the file DocumentFormat.OpenXml.dll. Is that enough?

New Post: Validation of cell using fixed List of values

$
0
0
Obviously it took some time to find a little bit of spare time for this pet project of me, but:
thank you Marie, it worked.
Viewing all 1877 articles
Browse latest View live


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