Rated 5 Stars (out of 5) - Could it be that my prayers have been answered?
I am pleasantly surprised to have found this initiative. I was concerned about the availability of source, but it is all there and compiles easily. My other worry was the low version number (0.75) but some quick tests tell me that most of what I need -and more- is available. I intend to be an active member of the community. Kudos and thanks!!
↧
Reviewed: ClosedXML 0.75.0 (Oct 07, 2014)
↧
Reviewed: ClosedXML 0.75.0 (Oct 07, 2014)
Rated 5 Stars (out of 5) - Could it be that my prayers have been answered?
I am pleasantly surprised to have found this initiative. I was concerned about the availability of source code, but it is all there and compiles easily. My other worry was the low version number (0.75) but some quick tests tell me that most of what I need -and more- is available. I intend to be an active member of the community. Kudos and thanks!!
↧
↧
New Post: Change header of table
Thank you very much for your answer. Unfortunately, it still does not work. I have illustrated an example:
Kind regards Alexander
public class Test
{
public string Test1 { get; set; }
public string Test2 { get; set; }
}
public void MyTest()
{
List<Test> testList = new List<Test>
{
new Test{Test1 = "T1",Test2 = "T2"},
new Test{Test1 = "T1",Test2 = "T2"}
};
var wb1 = new XLWorkbook();
var ws = wb1.Worksheets.Add("Mysheet");
ws.Cell(1, 1).InsertTable(testList);
wb1.SaveAs(@"C:\Test\Test1.xlsx");
var wb2 = new XLWorkbook();
var ws2 = wb2.Worksheets.Add("Mysheet");
var tb2 = ws2.Cell(1, 1).InsertTable(testList);
const string newHeader = "TestNew";
for (int i = 0; i < tb2.Fields.Count(); i++)
{
tb2.Field(i).Name = string.Format("{0} {1}", newHeader, i);
}
wb2.SaveAs(@"C:\Test\Test2.xlsx");
}
File Test1.xlsx opens normally. Test2.xlsx opens after a repair process from excel. This is the message which excel provides: <?xml version="1.0" encoding="UTF-8" standalone="true"?>
-<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<logFileName>error195720_01.xml</logFileName>
<summary>Fehler in Datei 'C:\Test\Test2.xlsx'</summary>
-<repairedRecords summary="Die folgenden Reparaturen wurden durchgeführt:_x000d__x000a__x000d__x000a_">
<repairedRecord>Reparierte Datensätze: Tabelle von /xl/tables/table.xml-Part (Tabelle)</repairedRecord>
</repairedRecords>
</recoveryLog>
Are there some special characters which are not allowed? Or do you have any idea from where it comes? Kind regards Alexander
↧
Created Unassigned: Freezing first row causes scroll wheel to no longer work. [9374]
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!
```
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!
↧
Commented Unassigned: Freezing first row causes scroll wheel to no longer work. [9374]
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: did you try sheet.ActiveCell?
```
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: did you try sheet.ActiveCell?
↧
↧
Reopened Unassigned: Exception while reading a cell with datatype number and cell is empty. [9373]
Hi,
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
↧
Commented Unassigned: Exception while reading a cell with datatype number and cell is empty. [9373]
Hi,
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
Comments: Thanks MDeLeon for ur reply. The exception issue is solved, but Arithmetic operations are not working when i try to reference those cells. In the generated execl, Cell A3 is supposed to be 300, but it is showing 0 in-spite there are values under A1 and A2. ``` var locationValue1 = 100; var cellindex = "A1"; worksheetProposal.Cell(cellindex) .SetValue(locationValue1 == 0 ? string.Empty : locationValue1.ToString()) .SetDataType(XLCellValues.Number); worksheetProposal.Cell(cellindex ).Style.NumberFormat.NumberFormatId = 2; var locationValue2 = 200; cellindex = "A2"; worksheetProposal.Cell(cellindex) .SetValue(locationValue2 == 0 ? string.Empty : locationValue2.ToString()) .SetDataType(XLCellValues.Number); worksheetProposal.Cell(cellindex ).Style.NumberFormat.NumberFormatId = 2; cellindex = "A3"; var formula = "SUM(A1:A2)"; worksheetProposal.Cell(cellindex ).SetFormulaA1(formula); ``` See the attachment for the excel sheet.
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
Comments: Thanks MDeLeon for ur reply. The exception issue is solved, but Arithmetic operations are not working when i try to reference those cells. In the generated execl, Cell A3 is supposed to be 300, but it is showing 0 in-spite there are values under A1 and A2. ``` var locationValue1 = 100; var cellindex = "A1"; worksheetProposal.Cell(cellindex) .SetValue(locationValue1 == 0 ? string.Empty : locationValue1.ToString()) .SetDataType(XLCellValues.Number); worksheetProposal.Cell(cellindex ).Style.NumberFormat.NumberFormatId = 2; var locationValue2 = 200; cellindex = "A2"; worksheetProposal.Cell(cellindex) .SetValue(locationValue2 == 0 ? string.Empty : locationValue2.ToString()) .SetDataType(XLCellValues.Number); worksheetProposal.Cell(cellindex ).Style.NumberFormat.NumberFormatId = 2; cellindex = "A3"; var formula = "SUM(A1:A2)"; worksheetProposal.Cell(cellindex ).SetFormulaA1(formula); ``` See the attachment for the excel sheet.
↧
New Post: Exception while reading a cell with datatype number and cell is empty.
Thanks MDeLeon for ur reply.
The exception issue is solved, but Arithmetic operations are not working when i try to reference those cells.
In the generated execl, Cell A3 is supposed to be 300, but it is showing 0 in-spite there are values under A1 and A2.
https://www.codeplex.com/Download/AttachmentDownload.ashx?ProjectName=closedxml&WorkItemId=9373&FileAttachmentId=919314
The exception issue is solved, but Arithmetic operations are not working when i try to reference those cells.
In the generated execl, Cell A3 is supposed to be 300, but it is showing 0 in-spite there are values under A1 and A2.
var locationValue1 = 100;
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue1 == 0 ? string.Empty : locationValue1.ToString());
worksheetProposal.Cell(cellindex ).Style.NumberFormat.NumberFormatId = 2;
var locationValue2 = 200;
cellindex = "A2";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue2 == 0 ? string.Empty : locationValue2.ToString());
worksheetProposal.Cell(cellindex ).Style.NumberFormat.NumberFormatId = 2;
cellindex = "A3";
var formula = "SUM(A1:A2)";
worksheetProposal.Cell(cellindex ).SetFormulaA1(formula);
See the attachment for the excel sheet.https://www.codeplex.com/Download/AttachmentDownload.ashx?ProjectName=closedxml&WorkItemId=9373&FileAttachmentId=919314
↧
Commented Unassigned: Exception while reading a cell with datatype number and cell is empty. [9373]
Hi,
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
Comments: Ignore the previous code, following is the code to reproduce the arithmetic issue in excel, ``` var locationValue1 = 100; var cellindex = "A1"; worksheetProposal.Cell(cellindex) .SetValue(locationValue1 == 0 ? string.Empty : locationValue1.ToString()); worksheetProposal.Cell(cellindex ).Style.NumberFormat.NumberFormatId = 2; var locationValue2 = 200; cellindex = "A2"; worksheetProposal.Cell(cellindex) .SetValue(locationValue2 == 0 ? string.Empty : locationValue2.ToString()); worksheetProposal.Cell(cellindex ).Style.NumberFormat.NumberFormatId = 2; cellindex = "A3"; var formula = "SUM(A1:A2)"; worksheetProposal.Cell(cellindex ).SetFormulaA1(formula); ```
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
Comments: Ignore the previous code, following is the code to reproduce the arithmetic issue in excel, ``` var locationValue1 = 100; var cellindex = "A1"; worksheetProposal.Cell(cellindex) .SetValue(locationValue1 == 0 ? string.Empty : locationValue1.ToString()); worksheetProposal.Cell(cellindex ).Style.NumberFormat.NumberFormatId = 2; var locationValue2 = 200; cellindex = "A2"; worksheetProposal.Cell(cellindex) .SetValue(locationValue2 == 0 ? string.Empty : locationValue2.ToString()); worksheetProposal.Cell(cellindex ).Style.NumberFormat.NumberFormatId = 2; cellindex = "A3"; var formula = "SUM(A1:A2)"; worksheetProposal.Cell(cellindex ).SetFormulaA1(formula); ```
↧
↧
Commented Unassigned: Freezing first row causes scroll wheel to no longer work. [9374]
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: I tried "ws.ActiveCell = ws.Cell(2,1);" with first row frozen. This has the same effect as clicking in a cell and doesn't help.
```
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: I tried "ws.ActiveCell = ws.Cell(2,1);" with first row frozen. This has the same effect as clicking in a cell and doesn't help.
↧
Closed Unassigned: Exception while reading a cell with datatype number and cell is empty. [9373]
Hi,
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
Comments: that's expected when you try to add 2 strings and not 2 numbers. you get the same result in Excel.
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
Comments: that's expected when you try to add 2 strings and not 2 numbers. you get the same result in Excel.
↧
Commented Unassigned: Exception while reading a cell with datatype number and cell is empty. [9373]
Hi,
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
Comments: Does anyone has a solution for this??
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
Comments: Does anyone has a solution for this??
↧
New Post: Exception while reading a cell with datatype number and cell is empty.
Does anyone has a solution for this??
↧
↧
Commented Unassigned: Exception while reading a cell with datatype number and cell is empty. [9373]
Hi,
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
Comments: The problem is in your code. You can't add 2 strings/texts. Try to do it in Excel: put '100 on cell A1 (include the apostrophe to tell Excel that it's a string), '200 on cell A2 (include the apostrophe to tell Excel that it's a string), and =SUM(A1:A2) on A3. It will give you 0. One quick fix for your code is to use cell.Value = "string with number". It will detect a number in the string and convert it accordingly. cell.SetValue doesn't convert strings into numbers. It assumes that if you pass a string you want it to be string in the cell.
I am getting a runtime exception 'Input string was not in a correct format' when I am trying to read a cell of type 'Number' and when its blank in the excel sheet.
Below is the code while writing the excel. Here I m explicitly inserting __blank__ when the value is __zero__ and setting the datatype as XLCellValues.Number.
```
var locationValue = GetLocValue(1);
var cellindex = "A1";
worksheetProposal.Cell(cellindex)
.SetValue(locationValue == 0 ? string.Empty : locationValue.ToString())
.SetDataType(XLCellValues.Number);
```
Below is the code while reading the generated excel. Its throwing an exception when m tring the read the same cell "A1" when its blank.
```
var LocationId = worksheet.Cell("A1").Value; // Runtime exception 'Input string was not in a correct format' when its blank.
```
Does anyone came across such scenario? Any solution for this?
Comments: The problem is in your code. You can't add 2 strings/texts. Try to do it in Excel: put '100 on cell A1 (include the apostrophe to tell Excel that it's a string), '200 on cell A2 (include the apostrophe to tell Excel that it's a string), and =SUM(A1:A2) on A3. It will give you 0. One quick fix for your code is to use cell.Value = "string with number". It will detect a number in the string and convert it accordingly. cell.SetValue doesn't convert strings into numbers. It assumes that if you pass a string you want it to be string in the cell.
↧
New Post: Exception while reading a cell with datatype number and cell is empty.
The problem is in your code. You're trying to add 2 strings.
↧
New Post: Vlookup function supported by Closedxml
Hi.
I'm trying to retrieve a value from a cell, that is based on the Vlookup function. I get an error saying "Syntax error". From what I could see from https://closedxml.codeplex.com/wikipage?title=Evaluating%20Formulas, the Vlookup function is not supported by ClosedXML.
Do you know when the Vlookup function will be included in Closedxml?
Thank you in advance.
Mads
I'm trying to retrieve a value from a cell, that is based on the Vlookup function. I get an error saying "Syntax error". From what I could see from https://closedxml.codeplex.com/wikipage?title=Evaluating%20Formulas, the Vlookup function is not supported by ClosedXML.
Do you know when the Vlookup function will be included in Closedxml?
Thank you in advance.
Mads
↧
Created Unassigned: ClosedXML.Excel.IXLRow.Cell() returning wrong values [9375]
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.
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.
↧
↧
Edited Unassigned: ClosedXML.Excel.IXLRow.Cell() returning wrong values [9375]
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.
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.
↧
Commented Unassigned: ClosedXML.Excel.IXLRow.Cell() returning wrong values [9375]
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: I don't understand the problem... ``` var wb = new XLWorkbook(); var ws = wb.AddWorksheet("Sheet1"); ws.Cell("A1").Value = "X"; var row1 = ws.LastRowUsed(); // At this point: // row1 points to Row #1 // ws.LastRowUsed() points to Row #1 ws.Cell("A2").Value = "X"; var row2 = ws.LastRowUsed(); // At this point: // row1 points to Row #1 // row2 points to Row #2 // ws.LastRowUsed() points to Row #2 ``` This is as it should be
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: I don't understand the problem... ``` var wb = new XLWorkbook(); var ws = wb.AddWorksheet("Sheet1"); ws.Cell("A1").Value = "X"; var row1 = ws.LastRowUsed(); // At this point: // row1 points to Row #1 // ws.LastRowUsed() points to Row #1 ws.Cell("A2").Value = "X"; var row2 = ws.LastRowUsed(); // At this point: // row1 points to Row #1 // row2 points to Row #2 // ws.LastRowUsed() points to Row #2 ``` This is as it should be
↧
Commented Unassigned: ClosedXML.Excel.IXLRow.Cell() returning wrong values [9375]
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: The problem is: var wbOld = new XLWorkbook("filename"); var wsOld = wbOld.Worksheet(1); var oldRow = wsOld.Row(2); Row(2) does not exist. But oldRow.Cell(1) returns the value of the first row cell(1). Not a null from the second row. So i access the second row from the sheet and get values from the first row.
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: The problem is: var wbOld = new XLWorkbook("filename"); var wsOld = wbOld.Worksheet(1); var oldRow = wsOld.Row(2); Row(2) does not exist. But oldRow.Cell(1) returns the value of the first row cell(1). Not a null from the second row. So i access the second row from the sheet and get values from the first row.
↧