Is there a way to remove a range? Not the content of the range but the range itself.
↧
New Comment on "Accessing Named Ranges"
↧
Created Unassigned: Problem inserting Conditional Formulas [9332]
Hi,
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
↧
↧
New Post: Copy Worksheet is very very slow
Unfortunately you're going to have to go with SAX: http://blogs.msdn.com/b/brian_jones/archive/2010/06/22/writing-large-excel-files-with-the-open-xml-sdk.aspx
ClosedXML isn't the right tool for this job.
Sorry =(
ClosedXML isn't the right tool for this job.
Sorry =(
↧
New Post: Copy Worksheet is very very slow
I will read up on this. If I can just replace the merge I am good.
↧
Source code checked in, #66c12538bf5e7a6b20d66f08cba269eb730a4431
Fixed a bug with formulas and strings
↧
↧
Closed Unassigned: Problem inserting Conditional Formulas [9332]
Hi,
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
Comments: Yes and No are invalid keywords. Put them in quotes. You did point me to a bug in the code so pick the latest source code. var wb = new XLWorkbook(); var ws = wb.AddWorksheet("Sheet"); ws.FirstCell().SetValue(1) .CellBelow().SetFormulaA1("IF(A1>0,Yes,No)") // Invalid .CellBelow().SetFormulaA1("IF(A1>0,\"Yes\",\"No\")") // OK .CellBelow().SetFormulaA1("IF(A1>0,TRUE,FALSE)"); // OK
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
Comments: Yes and No are invalid keywords. Put them in quotes. You did point me to a bug in the code so pick the latest source code. var wb = new XLWorkbook(); var ws = wb.AddWorksheet("Sheet"); ws.FirstCell().SetValue(1) .CellBelow().SetFormulaA1("IF(A1>0,Yes,No)") // Invalid .CellBelow().SetFormulaA1("IF(A1>0,\"Yes\",\"No\")") // OK .CellBelow().SetFormulaA1("IF(A1>0,TRUE,FALSE)"); // OK
↧
New Post: InsertRowsBelow bug?
It works exactly as it's supposed to work. The named range "_MergedCell" points to the cell "A1" not "A1:B1". So when you call .Range("_MergedCell") it's the same as calling .Range("A1")
↧
New Post: Copy Worksheet is very very slow
Did you have any idea why the copyto function takes so much time and memory? Is there anything I could do to cut down on either the processing time or the amount of memory used? I am sure it is keeping the entire book in memory. It would be nice if there was a way to ‘close’ a sheet to disk to take a sheet out of memory.
<p class="Ms
↧
New Post: Copy Worksheet is very very slow
Yes, it does keep the entire workbook in memory before saving it to disk. This is why I find it so odd that it works one way but not the other. Either way the entire workbook is kept in memory. You can only save data to the disk as you're creating it if you can make assumptions about the workbook. This is something ClosedXML can't do so it's the reason why you should go with SAX.
↧
↧
New Post: Problem inserting conditional formulas
Hi,
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
↧
Commented Unassigned: Problem inserting Conditional Formulas [9332]
Hi,
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
Comments: Thanks for the reply MDeLeon... I even tried this. But the actual problem is SetFormulaA1 method is replacing the ","(Comma) with ";"(Semicolon) in the syntax while inserting the formula into the excel sheet, which is wrong in MS Excel. SetFormulaA1("IF(A1>0,TRUE,FALSE)") What I am getting from SetFormulaA1: IF(A1>0; TRUE; FALSE) //this doenst work in MS excel MS Excel Syntax: IF(A1>0, TRUE, FALSE) How to get the formula as it is... Is there anyway we c
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
Comments: Thanks for the reply MDeLeon... I even tried this. But the actual problem is SetFormulaA1 method is replacing the ","(Comma) with ";"(Semicolon) in the syntax while inserting the formula into the excel sheet, which is wrong in MS Excel. SetFormulaA1("IF(A1>0,TRUE,FALSE)") What I am getting from SetFormulaA1: IF(A1>0; TRUE; FALSE) //this doenst work in MS excel MS Excel Syntax: IF(A1>0, TRUE, FALSE) How to get the formula as it is... Is there anyway we c
↧
Reopened Unassigned: Problem inserting Conditional Formulas [9332]
Hi,
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
↧
Edited Unassigned: Problem inserting Conditional Formulas [9332]
Hi,
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
.............................................................................................................................................
Thanks for the reply MDeLeon...
I even tried this. But the actual problem is SetFormulaA1 method is replacing the ","(Comma) with ";"(Semicolon) in the syntax while inserting the formula into the excel sheet, which is wrong in MS Excel.
SetFormulaA1("IF(A1>0,TRUE,FALSE)")
What I am getting from SetFormulaA1: IF(A1>0; TRUE; FALSE) //this doenst work in MS excel
MS Excel Syntax: IF(A1>0, TRUE, FALSE)
How to get the formula as it is...
I finding issues in inserting conditional formulas in closed xml.
For Example:
If I want to insert following formula into excel sheet
=IF(A1 > 0, Yes, No)
It appears as =IF(A1 > 0 ; Yes ; No) which is not supported in Microsoft Excel. It says formula is corrupt.
Can anyone help me??
.............................................................................................................................................
Thanks for the reply MDeLeon...
I even tried this. But the actual problem is SetFormulaA1 method is replacing the ","(Comma) with ";"(Semicolon) in the syntax while inserting the formula into the excel sheet, which is wrong in MS Excel.
SetFormulaA1("IF(A1>0,TRUE,FALSE)")
What I am getting from SetFormulaA1: IF(A1>0; TRUE; FALSE) //this doenst work in MS excel
MS Excel Syntax: IF(A1>0, TRUE, FALSE)
How to get the formula as it is...
↧
↧
New Post: PivotTable row and column labels broken by recent change?
I'm using code to dynamically create a spreadsheet to export data from a database.
I've taken my code, put in one row of hard-coded sample data, and removed most of the columns to leave a fairly simple reproduction scenario.
This attempts to create a pivot table using the "Category" and "Item" fields in the pivot table rows (they're the third and fourth columns in the source data), but the spreadsheet when opened gives the error as before, and the pivot table shows the date and quantity as the pivot rows (which were the first two columns in the source data).
I've taken my code, put in one row of hard-coded sample data, and removed most of the columns to leave a fairly simple reproduction scenario.
This attempts to create a pivot table using the "Category" and "Item" fields in the pivot table rows (they're the third and fourth columns in the source data), but the spreadsheet when opened gives the error as before, and the pivot table shows the date and quantity as the pivot rows (which were the first two columns in the source data).
/// <summary>
/// Create OpenXML spreadsheet for export
/// </summary>
/// <returns></returns>
public XLWorkbook GenerateOrderLineSpreadsheet(IEnumerable<OrderLine> orderLines)
{
var workbook = new XLWorkbook();
workbook.SetDocumentProperties(this, "Order lines");
var sheet = workbook.Worksheets.Add("orderlines");
int row = 1;
int column = 1;
sheet.Cell(row, column++).Value = "Date";
sheet.Cell(row, column++).Value = "Quantity";
sheet.Cell(row, column++).Value = "Category";
sheet.Cell(row, column++).Value = "Item";
sheet.Cell(row, column++).Value = "Unit price";
sheet.Cell(row, column++).Value = "Total price";
// Sample data row
row++;
column = 1;
sheet.Cell(row, column++).Value = new DateTime(2014, 6, 21);
sheet.Cell(row, column++).Value = 1;
sheet.Cell(row, column++).Value = "Widgets";
sheet.Cell(row, column++).Value = "Pro widget";
sheet.Cell(row, column++).Value = "1.23";
sheet.Cell(row, column++).Value = "1.23";
var dataRange = sheet.RangeUsed();
// Add a new sheet for our pivot table
var pivotTableSheet = workbook.Worksheets.Add("PivotTable");
// Create the pivot table, using the data from the "PastrySalesData" table
var pt = pivotTableSheet.PivotTables.AddNew("PivotTable", pivotTableSheet.Cell(1, 1), dataRange);
// The rows in our pivot table will be the names of the categories
pt.RowLabels.Add("Category");
pt.RowLabels.Add("Item");
pt.Values.Add("Total price");
return workbook;
}
↧
New Post: calc value from NamedRange between different worksheet
Hi,this is not the result that I want and please do me a favor. :-D
Example,
[Case A]
In Sheet1 has Named cell ,_tmpResult (Address:A1),_tmpA (Address:B1,value:1) ,_tmpB(Address:C1,value:2)
and _tmpResult forluma is "=_tmpB+_tmpA" then get the result is 3, it works ok.
[Case B]
But when put the cell _tmpB,_tmpA into Sheet2,and the _tmpResult also in the Sheet1 then read the value from named cell _tmpResult from the closedXML will throw a exceptipn(System.NullReferenceException).
Part code:
worksheet.Cell("_tmpResult").Value; (Case A works well,but wrong in Case B)
What can i do to calc the value ok? I have such lot this in my excel,thank U
Example,
[Case A]
In Sheet1 has Named cell ,_tmpResult (Address:A1),_tmpA (Address:B1,value:1) ,_tmpB(Address:C1,value:2)
and _tmpResult forluma is "=_tmpB+_tmpA" then get the result is 3, it works ok.
[Case B]
But when put the cell _tmpB,_tmpA into Sheet2,and the _tmpResult also in the Sheet1 then read the value from named cell _tmpResult from the closedXML will throw a exceptipn(System.NullReferenceException).
Part code:
worksheet.Cell("_tmpResult").Value; (Case A works well,but wrong in Case B)
What can i do to calc the value ok? I have such lot this in my excel,thank U
↧
New Post: Iphone-Ipad cant open genereted files
Problem could be not in ClosedXml, but in openXml, because i tried to use it and caught the same error on iphone.
↧
Created Unassigned: Issue while copying worksheets [9333]
Hi,
I am trying to copy worksheets from one workbook to another. But AddWorksheet() & copyTo() methods throws "An item with the same key has already been added" exception while copying.
Here is the code
var workbook = new XLWorkbook();
WriteStaticSheets(workbook);
public void WriteStaticSheets(XLWorkbook wb)
{
var workbookTemplate = new XLWorkbook("D:\\test.xlsx");
foreach(var ws in workbookTemplate.Worksheets)
{
wb.AddWorksheet(ws); // throws "An item with the same key has already been added" exception
ws.CopyTo(wb,ws.Name) //even this throws the same exception
}
}
can anyone figure it out, what is the issue???
I am trying to copy worksheets from one workbook to another. But AddWorksheet() & copyTo() methods throws "An item with the same key has already been added" exception while copying.
Here is the code
var workbook = new XLWorkbook();
WriteStaticSheets(workbook);
public void WriteStaticSheets(XLWorkbook wb)
{
var workbookTemplate = new XLWorkbook("D:\\test.xlsx");
foreach(var ws in workbookTemplate.Worksheets)
{
wb.AddWorksheet(ws); // throws "An item with the same key has already been added" exception
ws.CopyTo(wb,ws.Name) //even this throws the same exception
}
}
can anyone figure it out, what is the issue???
↧
↧
Edited Unassigned: Issue while copying worksheets [9333]
Hi,
I am trying to copy worksheets from one workbook to another. But AddWorksheet() & copyTo() methods throws "An item with the same key has already been added" exception while copying.
Here is the code:
{
var workbook = new XLWorkbook();
WriteStaticSheets(workbook);
public void WriteStaticSheets(XLWorkbook wb)
{
var workbookTemplate = new XLWorkbook("D:\\test.xlsx");
foreach(var ws in workbookTemplate.Worksheets)
{
wb.AddWorksheet(ws); // throws "An item with the same key has already been added" exception
ws.CopyTo(wb,ws.Name) //even this throws the same exception
}
}
}
can anyone figure it out, what is the issue???
I am trying to copy worksheets from one workbook to another. But AddWorksheet() & copyTo() methods throws "An item with the same key has already been added" exception while copying.
Here is the code:
{
var workbook = new XLWorkbook();
WriteStaticSheets(workbook);
public void WriteStaticSheets(XLWorkbook wb)
{
var workbookTemplate = new XLWorkbook("D:\\test.xlsx");
foreach(var ws in workbookTemplate.Worksheets)
{
wb.AddWorksheet(ws); // throws "An item with the same key has already been added" exception
ws.CopyTo(wb,ws.Name) //even this throws the same exception
}
}
}
can anyone figure it out, what is the issue???
↧
Edited Unassigned: Issue while copying worksheets [9333]
Hi,
I am trying to copy worksheets from one workbook to another. But AddWorksheet() & copyTo() methods throws "An item with the same key has already been added" exception while copying.
Here is the code:
()
{
var workbook = new XLWorkbook();
WriteStaticSheets(workbook);
public void WriteStaticSheets(XLWorkbook wb)
{
var workbookTemplate = new XLWorkbook("D:\\test.xlsx");
foreach(var ws in workbookTemplate.Worksheets)
{
wb.AddWorksheet(ws); // throws "An item with the same key has already been added" exception
ws.CopyTo(wb,ws.Name) //even this throws the same exception
}
}
}
can anyone figure it out, what is the issue???
I am trying to copy worksheets from one workbook to another. But AddWorksheet() & copyTo() methods throws "An item with the same key has already been added" exception while copying.
Here is the code:
()
{
var workbook = new XLWorkbook();
WriteStaticSheets(workbook);
public void WriteStaticSheets(XLWorkbook wb)
{
var workbookTemplate = new XLWorkbook("D:\\test.xlsx");
foreach(var ws in workbookTemplate.Worksheets)
{
wb.AddWorksheet(ws); // throws "An item with the same key has already been added" exception
ws.CopyTo(wb,ws.Name) //even this throws the same exception
}
}
}
can anyone figure it out, what is the issue???
↧
Edited Unassigned: Issue while copying worksheets [9333]
Hi,
I am trying to copy worksheets from one workbook to another. But AddWorksheet() & copyTo() methods throws "An item with the same key has already been added" exception while copying.
can anyone figure it out, what is the issue???
Here is the code:
```
var workbook = new XLWorkbook();
WriteStaticSheets(workbook);
public void WriteStaticSheets(XLWorkbook wb)
{
var workbookTemplate = new XLWorkbook("D:\\test.xlsx");
foreach(var ws in workbookTemplate.Worksheets)
{
wb.AddWorksheet(ws); // throws "An item with the same key has already been added"exception
ws.CopyTo(wb,ws.Name) //even this throws the same exception
}
}
```
I am trying to copy worksheets from one workbook to another. But AddWorksheet() & copyTo() methods throws "An item with the same key has already been added" exception while copying.
can anyone figure it out, what is the issue???
Here is the code:
```
var workbook = new XLWorkbook();
WriteStaticSheets(workbook);
public void WriteStaticSheets(XLWorkbook wb)
{
var workbookTemplate = new XLWorkbook("D:\\test.xlsx");
foreach(var ws in workbookTemplate.Worksheets)
{
wb.AddWorksheet(ws); // throws "An item with the same key has already been added"exception
ws.CopyTo(wb,ws.Name) //even this throws the same exception
}
}
```
↧