AdjustToContents and cell.GetFormattedString now use formulas
↧
Source code checked in, #c07fba02616522cdb085c1edf89ff01a93797e2c
↧
New Post: Columns.AdjustToContents - Problem with formula result
Pick the latest source code.
↧
↧
New Post: PivotTable row and column labels broken by recent change?
Interesting,
Are you opening an existing file with a pivot table with ClosedXML? If so please attach the file to an Issue ticket (remove/replace any data that can't be shared)
If you're creating a file with a pivot table then please post a piece of code that can reproduce the problem.
Thanks
Are you opening an existing file with a pivot table with ClosedXML? If so please attach the file to an Issue ticket (remove/replace any data that can't be shared)
If you're creating a file with a pivot table then please post a piece of code that can reproduce the problem.
Thanks
↧
New Post: XLSM save file have disabled buttons
Pick up the latest source code and try again because I can open and save the file no problem and the output file opens fine in Excel.
The corrupted one you shared is indeed bad though. I just can't reproduce it.
The corrupted one you shared is indeed bad though. I just can't reproduce it.
↧
New Post: CustomXMLPart
You need to use the OpenXML SDK to manipulate the XML files directly.
↧
↧
New Post: Copy Worksheet is very very slow
I'd say compile to x64 and create the file directly without the two steps.
Another thing that doesn't make sense is why would it run out of memory when you're creating a file with 200 sheets and not when you're copying 200 sheets. It doesn't make sense.
Another thing that doesn't make sense is why would it run out of memory when you're creating a file with 200 sheets and not when you're copying 200 sheets. It doesn't make sense.
↧
New Post: InsertRowsBelow bug?
Please attach the file because I can't reproduce it. The following works as expected:
var wb = new XLWorkbook();
var ws1 = wb.AddWorksheet("Sheet1");
ws1.Range("A1:C20").Value = "X";
ws1.Range("A1:B1").AddToNamed("Sheet1Named");
ws1.Range("Sheet1Named").InsertRowsBelow(10);
var ws2 = wb.AddWorksheet("Sheet2");
ws2.Range("A1:C20").Value = "X";
ws2.Range("A1:B1").InsertRowsBelow(10);
var ws3 = wb.AddWorksheet("Sheet3");
ws3.Range("A1:C20").Value = "X";
ws3.Range("A1").InsertRowsBelow(10);
About the merging, I try to mimic Excel's behavior as much as possible and that's why you don't get the merged cells with the insert below. You'd have to create the merges manually.↧
New Post: Excel 2013 - 2010 compatibility
long/old thread ataziz, How can I reproduce your error?
↧
Closed Unassigned: creating multiple files at once [9328]
hi,
I have an issue when creating multiple excel files. The problem is that every single file who is opened, opens is the same instance of excel (i.e. opened 3 excel files, 1 excel.exe in task manager). its unhandy when working with multiple generated reports.
I tried to create diferent workbooks,that didnt helped, and also noticed that file size sums up, and last generated file size is the biggest, independently on the content of file. It seems that some information remains the same for all generated files(did i forgot something important to clean?).
So is there any way to create separate multiple excel files?
here is my example:
var wb = new XLWorkbook();
var wb2 = new XLWorkbook();
string select = "select * from table";
//firstfile
sheetName = "name1";
sheetName2 = "name2";
DataTable dataTable = DB.selectfromDBSA(select, sheetName);
wb.AddWorksheet(dataTable);
dataTable = DB.selectfromDBSA(select, sheetName2);
wb.AddWorksheet(dataTable);
wb.SaveAs("temp/test.xlsx");
dataTable.Clear();
wb.Worksheets.Delete(sheetName);
wb.Worksheets.Delete(sheetName2);
//for example this file weight is 175kb
//second file
sheetName = "name1";
sheetName2 = "name2";
DataTable dataTable = DB.selectfromDBSA(select, sheetName);
wb2.AddWorksheet(dataTable);
dataTable = DB.selectfromDBSA(select, sheetName2);
wb2.AddWorksheet(dataTable);
wb2.SaveAs("temp/test2.xlsx");
dataTable.Clear();
wb2.Worksheets.Delete(sheetName);
wb2.Worksheets.Delete(sheetName2);
//for example this file weight is 285kb, but information is the same, because its same query to database.
thanks,
I have an issue when creating multiple excel files. The problem is that every single file who is opened, opens is the same instance of excel (i.e. opened 3 excel files, 1 excel.exe in task manager). its unhandy when working with multiple generated reports.
I tried to create diferent workbooks,that didnt helped, and also noticed that file size sums up, and last generated file size is the biggest, independently on the content of file. It seems that some information remains the same for all generated files(did i forgot something important to clean?).
So is there any way to create separate multiple excel files?
here is my example:
var wb = new XLWorkbook();
var wb2 = new XLWorkbook();
string select = "select * from table";
//firstfile
sheetName = "name1";
sheetName2 = "name2";
DataTable dataTable = DB.selectfromDBSA(select, sheetName);
wb.AddWorksheet(dataTable);
dataTable = DB.selectfromDBSA(select, sheetName2);
wb.AddWorksheet(dataTable);
wb.SaveAs("temp/test.xlsx");
dataTable.Clear();
wb.Worksheets.Delete(sheetName);
wb.Worksheets.Delete(sheetName2);
//for example this file weight is 175kb
//second file
sheetName = "name1";
sheetName2 = "name2";
DataTable dataTable = DB.selectfromDBSA(select, sheetName);
wb2.AddWorksheet(dataTable);
dataTable = DB.selectfromDBSA(select, sheetName2);
wb2.AddWorksheet(dataTable);
wb2.SaveAs("temp/test2.xlsx");
dataTable.Clear();
wb2.Worksheets.Delete(sheetName);
wb2.Worksheets.Delete(sheetName2);
//for example this file weight is 285kb, but information is the same, because its same query to database.
thanks,
↧
↧
New Post: Copy Worksheet is very very slow
I compile with ‘ANY CPU’, and I’ve verified that it is not running 32 bit. (Task manager does not have the ‘*32’ by it). So would compiling my app as X64 really make a difference?
Through ask manager, I’ve seen the memory hit 11 GB on this task, during the creation of the sheets. The resulting sheet is about 23 MB (which I know is compressed). So the 11 GB seems large.
A GREAT solution would be if you could tell ClosedXML to keep files on disk, rather than in memory.
↧
Closed Unassigned: Disable Autofilter in workbook [9330]
Hi,
When im exporting workbook i could see Filter enabled in header. I wants to disable filter option.
Thanks,
Ram
Comments: worksheet.AutoFilter.Clear();
When im exporting workbook i could see Filter enabled in header. I wants to disable filter option.
Thanks,
Ram
Comments: worksheet.AutoFilter.Clear();
↧
New Post: Copy Worksheet is very very slow
Can't do that, there are so many scenarios where you don't have access to a disk.
Back to your problem, if you can copy 200 sheets into a single file then you should be able to create the file one sheet at a time. You're probably leaving objects in memory.
Back to your problem, if you can copy 200 sheets into a single file then you should be able to create the file one sheet at a time. You're probably leaving objects in memory.
↧
New Post: Copy Worksheet is very very slow
Originally, I opened a workbook, and wrote everything to it, and then did a 'saveas' at the end. But it would never finish, it kept blowing for memory.
The change I made was to put each section into a {} block, where I first do a 'create' and right before the } I do a 'save as'. I then dispose it. Now it runs fine and has no memory issues.
Building the sheets takes 60 to 80 minutes depending on a few variables. This step takes very little memory now.
Merging the sheets takes 2 to 3 hours. This step takes a LOT of memory, and I am worried that as business grows, it could be an issue. I really need to find a better way to merge the sheets.
But then I have to merge them all at the end. At least now I can get the job done, and the user is happy with the ending results, they are just not happy with the time.
These worksheets are really ridiculous in size, but people making 3 times my salary are making those decisions, so they are smarter than me, right? <sarcasm>
↧
↧
New Post: Copy Worksheet is very very slow
I can't get past the fact that either way you end up with a huge file you need to save, what happens before shouldn't be an issue (you still need to save it). In the case where you copy the 200 sheets into a single file you still have a big file that needs to be saved, just as if you wrote the file in one shot.
Are you sure you're disposing objects when you write everything to it?
Are you sure you're disposing objects when you write everything to it?
↧
New Post: Copy Worksheet is very very slow
Other than putting the code block inside of a {} and calling the .Dispose() method before the }, I'm not sure what else I can do?
↧
New Post: Copy Worksheet is very very slow
have you tried something like this?
private static void Main(string[] args)
{
var wb = new XLWorkbook();
foreach (var sheetNum in Enumerable.Range(1, 200))
{
CreateSheet(wb, sheetNum);
}
wb.SaveAs("saved.xlsx");
}
private static void CreateSheet(XLWorkbook wb, Int32 sheetNum)
{
using (var ws = wb.AddWorksheet("Sheet " + sheetNum))
{
// Fill sheet
}
}
↧
New Post: Copy Worksheet is very very slow
Instead of having the using from the 'createsheet' as a separate method, I had the using inline. However, unless I am mistaken, that } after CreateSheet should cause a garbage collect no different than having the using be in a different method.
↧
↧
New Post: InsertRowsBelow bug?
Sometimes when write the date to the excel template file and some merges in this maybe cause difference between the closedxml, and I had create a lite demo show it if you have time. :-D
http://www.liuzhiyong2012.cn/dl/ClosedXML_Test.zip
Part Code:(And need download the template)
e.g. A
using (ClosedXML.Excel.XLWorkbook workbook = new ClosedXML.Excel.XLWorkbook("Test.xlsx"))
using (ClosedXML.Excel.XLWorkbook workbook = new ClosedXML.Excel.XLWorkbook("Test.xlsx"))
http://www.liuzhiyong2012.cn/dl/ClosedXML_Test.zip
Part Code:(And need download the template)
e.g. A
using (ClosedXML.Excel.XLWorkbook workbook = new ClosedXML.Excel.XLWorkbook("Test.xlsx"))
{
//workbook.Worksheet("Sheet2").Range("A1:B1").InsertRowsBelow(10);
workbook.Worksheet("Sheet2").Range("_MergedCell").InsertRowsBelow(10);
workbook.Worksheet("Sheet2").SetTabActive();
workbook.SaveAs("TestSave.xlsx");
}
e.g. Busing (ClosedXML.Excel.XLWorkbook workbook = new ClosedXML.Excel.XLWorkbook("Test.xlsx"))
{
workbook.Worksheet("Sheet3").Range("A1:B1").Merge();
workbook.Worksheet("Sheet3").Range("A1:B1").AddToNamed("_MergedCell2");
workbook.Worksheet("Sheet3").Range("_MergedCell2").Value = "MergedCellByCode";
workbook.Worksheet("Sheet3").Range("_MergedCell2").InsertRowsBelow(10);
workbook.Worksheet("Sheet3").SetTabActive();
workbook.SaveAs("TestSave2.xlsx");
}
↧
Source code checked in, #37812ba6ddd3d6e3539d9083da92239c14fda275
Memory and performance improvements
↧
Source code checked in, #b07f23417458fb066554b603a29b5f4b86e2865b
Quick fix
↧