Pick up the latest source code. I added the property cell.NewDataValidation. Again, use it only if you know there are no overlapping data validations.
↧
New Post: Data Validation Performance
↧
New Post: PivotTable row and column labels broken by recent change?
Hi,
I just tried upgrading from 0.71.1 to 0.72.3. It's great to see OpenXml 2.5 support. (I'm using .NET 4.5.)
However, one of my spreadsheets, with a pivot table, is broken, which was working before. When opening the spreadsheet Excel says the pivot table data is corrupted. Diffing the XML, I see it is the index number of the PivotTable RowLabels that has changed.
I think the change made in the following recent revision is wrong, and has broken it. By backing out the change to the "Fields" index in a local copy, it fixes the problem for me.
https://closedxml.codeplex.com/SourceControl/changeset/1571ed8f1d75c98f7e6f0c6e2047d73f5cfe0a95
Hope this helps.
Chris
I just tried upgrading from 0.71.1 to 0.72.3. It's great to see OpenXml 2.5 support. (I'm using .NET 4.5.)
However, one of my spreadsheets, with a pivot table, is broken, which was working before. When opening the spreadsheet Excel says the pivot table data is corrupted. Diffing the XML, I see it is the index number of the PivotTable RowLabels that has changed.
I think the change made in the following recent revision is wrong, and has broken it. By backing out the change to the "Fields" index in a local copy, it fixes the problem for me.
https://closedxml.codeplex.com/SourceControl/changeset/1571ed8f1d75c98f7e6f0c6e2047d73f5cfe0a95
Hope this helps.
Chris
↧
↧
Commented 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,
Comments: I think its with ClosedXML generated files, because if i open few regular excel files, then everything it's ok (this problem occurs only with generated files). Also besides that there is a problem, that i mentioned in the comment below description. And file sizes - if my query return a lot of data, someting about 6k rows, and then stacks thiese file sizes, and the last one weights about 2 or 3 MB, even if its empty. So maybe my technique is wrong, maybe you can suggest something that i can try? 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,
Comments: I think its with ClosedXML generated files, because if i open few regular excel files, then everything it's ok (this problem occurs only with generated files). Also besides that there is a problem, that i mentioned in the comment below description. And file sizes - if my query return a lot of data, someting about 6k rows, and then stacks thiese file sizes, and the last one weights about 2 or 3 MB, even if its empty. So maybe my technique is wrong, maybe you can suggest something that i can try? thanks.
↧
Commented 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,
Comments: I still have no clue what the problem is. How can I reproduce the problem?
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,
Comments: I still have no clue what the problem is. How can I reproduce the problem?
↧
New Post: Data Validation Performance
I was under the impression that if you insert rows before you set the values / style etc that it was suppose to improve performance, perhaps I was misinterpreting this.
I altered my code a bit to apply the data validation to all cells at once:
I altered my code a bit to apply the data validation to all cells at once:
var timer = System.Diagnostics.Stopwatch.StartNew();
using (XLWorkbook wb = new XLWorkbook(XLEventTracking.Disabled))
{
using (var ws = wb.AddWorksheet("MergeCellsWorksheet"))
{
int totalRows = 5000;
// Create some ranges
ws.Cell("AO1").Value = "A";
ws.Cell("AP1").Value = "B";
ws.Cell("AQ1").Value = "C";
ws.Cell("AR1").Value = "D";
ws.Cell("AS1").Value = "E";
ws.Cell("AT1").Value = "1";
ws.Cell("AU1").Value = "2";
var listRange = ws.Range("AO1:AU1");
var validationRanges = ws.Range("AA1:AA1");
IXLRanges ranges = ws.Ranges("AA1:AA1");
ranges = new XLRanges
// Insert rows first
ws.Row(totalRows).InsertRowsAbove(totalRows);
// Insert some values
for (int i = 1; i <= totalRows; i++)
{
ranges.Add(ws.Cell(i, 1));
Console.Clear();
Console.Write("{0:P1}",((double)i/(double)totalRows));
}
ranges.SetDataValidation().List(listRange);
}
wb.SaveAs(@"C:\Test2.xlsm");
}
timer.Stop();
Console.WriteLine();
Console.WriteLine("Took {0}s", timer.Elapsed.TotalSeconds);
This seemed to speed it up.↧
↧
New Post: Data Validation Performance
Use the new cell.NewDataValidation, it's faster.
The link you provided doesn't say insert empty rows, it says that [if you're going to inserte rows] don't insert them one by one, insert them all in one shot. There's no need to insert empty rows if you don't have to.
The link you provided doesn't say insert empty rows, it says that [if you're going to inserte rows] don't insert them one by one, insert them all in one shot. There's no need to insert empty rows if you don't have to.
↧
Commented 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,
Comments: I attached my generated files, there is same data to 1 and 3 file and 2 and 4 file, please can you compare thiese files and i think you might see the problem(file size, collumns, and they cannot be splited in the same window). the problem reproduction is simple, just use my code above, fill some data to datatable1 and datatable2, and save it to test1,test2, test3,test4 files. i suggest to save datatable1 data to 1 and 3 file, and datatable2 to 2 and 4 file, that could be easy to compare, how file size is summing up, and collums remain from the widest datatable. if there is a problem, i can share all the code, so you can replicate the same situation. 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,
Comments: I attached my generated files, there is same data to 1 and 3 file and 2 and 4 file, please can you compare thiese files and i think you might see the problem(file size, collumns, and they cannot be splited in the same window). the problem reproduction is simple, just use my code above, fill some data to datatable1 and datatable2, and save it to test1,test2, test3,test4 files. i suggest to save datatable1 data to 1 and 3 file, and datatable2 to 2 and 4 file, that could be easy to compare, how file size is summing up, and collums remain from the widest datatable. if there is a problem, i can share all the code, so you can replicate the same situation. thanks.
↧
Commented 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,
Comments: I figured it out what was wrong, it seems that my technique was wrong, i didnt cleaned temporary datatable inside DB class, cleared that and the problem with file size and collumns disapeared. But still remains the problem with instances, why it keeps opening in same instance? Could you try open few my attached files, and tell me if you have the same result? 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,
Comments: I figured it out what was wrong, it seems that my technique was wrong, i didnt cleaned temporary datatable inside DB class, cleared that and the problem with file size and collumns disapeared. But still remains the problem with instances, why it keeps opening in same instance? Could you try open few my attached files, and tell me if you have the same result? thanks.
↧
Commented 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,
Comments: "why it keeps opening in same instance?" What do you mean it keeps opening in the same instance? The excel files open in the same instance of Excel when you double click them in Windows Explorer?
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,
Comments: "why it keeps opening in same instance?" What do you mean it keeps opening in the same instance? The excel files open in the same instance of Excel when you double click them in Windows Explorer?
↧
↧
Commented 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,
Comments: yes, when I open generated files in windows explorer, for example two files, in task manager I see one process called "excel.exe", and I can't split them in the different corners of the monitor, to see one excel in foreground and another in background. They act like they would be as one file or opened on one instance or something(did you tried to open attached files?). If I move one, and another moves to same place.. I don't know how else to explain... but if I open new empty excel document(not generated with closedxml), I can split them like the way I want, for example, one in the left side, and other on the right side of the monitor, then I can analyze the data simultaneously. 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,
Comments: yes, when I open generated files in windows explorer, for example two files, in task manager I see one process called "excel.exe", and I can't split them in the different corners of the monitor, to see one excel in foreground and another in background. They act like they would be as one file or opened on one instance or something(did you tried to open attached files?). If I move one, and another moves to same place.. I don't know how else to explain... but if I open new empty excel document(not generated with closedxml), I can split them like the way I want, for example, one in the left side, and other on the right side of the monitor, then I can analyze the data simultaneously. thanks.
↧
Commented 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,
Comments: damn, I guess there was no problem at all... I just tried to open those files on another workstation, and it runs normally... I'm sorry for the confusion :) maybe there was some certain configuration of our company, or something else, I don't know. anyway thank you:)
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,
Comments: damn, I guess there was no problem at all... I just tried to open those files on another workstation, and it runs normally... I'm sorry for the confusion :) maybe there was some certain configuration of our company, or something else, I don't know. anyway thank you:)
↧
New Post: Data Validation Performance
You're right, this made a significant difference.
Side note, I noticed the DocumentFormat.OpenXml.dll ClosedXML is referencing needs to be v2.5, but the dll in the root directory from the source download seems to be v2.0. I just ended up downloading it from MS.
Thanks again for all your support!
Side note, I noticed the DocumentFormat.OpenXml.dll ClosedXML is referencing needs to be v2.5, but the dll in the root directory from the source download seems to be v2.0. I just ended up downloading it from MS.
Thanks again for all your support!
↧
Created 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
When im exporting workbook i could see Filter enabled in header. I wants to disable filter option.
Thanks,
Ram
↧
↧
New Post: Columns.AdjustToContents - Problem with formula result
I have the same issue.
↧
New Post: XLSM save file have disabled buttons
I'm using Closed XML for .Net 4.0 with Macro Enabled Excel, In the sheet I have some buttons, these buttons attached to macros, after opening and then saving the document using closed XML it get corrupted.
the following links show the two files.
https://drive.google.com/file/d/0B7EHvjiS0C8GYWdFSkFwZ3U4S28/edit?usp=sharing
https://drive.google.com/file/d/0B7EHvjiS0C8GUGtIbF84Mk1mZlk/edit?usp=sharing
the code used for opening and saving:
var workbook = new XLWorkbook("Supplier Cost Sheet Template v61.xlsm");
workbook.SaveAs("Book2.xlsm");
the following links show the two files.
https://drive.google.com/file/d/0B7EHvjiS0C8GYWdFSkFwZ3U4S28/edit?usp=sharing
https://drive.google.com/file/d/0B7EHvjiS0C8GUGtIbF84Mk1mZlk/edit?usp=sharing
the code used for opening and saving:
var workbook = new XLWorkbook("Supplier Cost Sheet Template v61.xlsm");
workbook.SaveAs("Book2.xlsm");
↧
Created Unassigned: XLSM save file get corrupted [9331]
I'm using Closed XML for .Net 4.0 with Macro Enabled Excel, In the sheet I have some buttons, these buttons attached to macros, after opening and then saving the document using closed XML it get corrupted.
Steps:
1- Run an application that opens the xlsm sheet and saving it using the code below:
var workbook = new XLWorkbook("original.xlsm");
workbook.SaveAs("cotrrpted after save.xlsm");
2- Open the save document sand then save it using Excel.
3- when try to open the document again it shows an error.
You can find the orignal and result files in the followig link or you can find them attached
https://drive.google.com/file/d/0B7EHvjiS0C8GYWdFSkFwZ3U4S28/edit?usp=sharing
https://drive.google.com/file/d/0B7EHvjiS0C8GUGtIbF84Mk1mZlk/edit?usp=sharing
I attached the files for preview
Steps:
1- Run an application that opens the xlsm sheet and saving it using the code below:
var workbook = new XLWorkbook("original.xlsm");
workbook.SaveAs("cotrrpted after save.xlsm");
2- Open the save document sand then save it using Excel.
3- when try to open the document again it shows an error.
You can find the orignal and result files in the followig link or you can find them attached
https://drive.google.com/file/d/0B7EHvjiS0C8GYWdFSkFwZ3U4S28/edit?usp=sharing
https://drive.google.com/file/d/0B7EHvjiS0C8GUGtIbF84Mk1mZlk/edit?usp=sharing
I attached the files for preview
↧
New Post: Excel 2013 - 2010 compatibility
Any updates, I'm facing the same problem
↧
↧
New Post: CustomXMLPart
Hi.
I am trying to figure out how to add/read/remove CustomXMLParts from a workbook, without luck. Is there a way to access this part of the workbook using ClosedXML?
About Custom XML Parts:
http://msdn.microsoft.com/en-us/library/bb608618.aspx
Regards
Martin
I am trying to figure out how to add/read/remove CustomXMLParts from a workbook, without luck. Is there a way to access this part of the workbook using ClosedXML?
About Custom XML Parts:
http://msdn.microsoft.com/en-us/library/bb608618.aspx
Regards
Martin
↧
New Post: Copy Worksheet is very very slow
I have a process that creates about 200 sheets. In the end, I want them all in one workbook. (long story, I know it's not the best design, but I'm stuck with it).
Originally I tried doing just that, one workbook and adding all the sheets, but I kept running out of memory. So I decided to create a workbook for each sheet, and then at the end, combine all of the sheets into one. I thought this would be more efficient, but it takes far longer to copy a sheet than to create it. Almost by a factor of 10 or so, which makes no sense at all. The copy should be very fast I would think. I would have expected the copy to be faster than the create.
Any ideas on this? Due to memory constraints, I think my approach of separate sheets and combining them is the way to go, but the copy is so dreadfully slow.
Originally I tried doing just that, one workbook and adding all the sheets, but I kept running out of memory. So I decided to create a workbook for each sheet, and then at the end, combine all of the sheets into one. I thought this would be more efficient, but it takes far longer to copy a sheet than to create it. Almost by a factor of 10 or so, which makes no sense at all. The copy should be very fast I would think. I would have expected the copy to be faster than the create.
Any ideas on this? Due to memory constraints, I think my approach of separate sheets and combining them is the way to go, but the copy is so dreadfully slow.
XLWorkbook wb = new XLWorkbook(XLEventTracking.Disabled);
foreach (SheetPart mySheetPart in mySheetParts)
{
XLWorkbook wbSource = new XLWorkbook(mySheetPart.FileName, XLEventTracking.Disabled);
foreach (IXLWorksheet copySheet in wbSource.Worksheets)
{
copySheet.CopyTo(wb, copySheet.Name);
}
wbSource.Dispose();
File.Delete(mySheetPart.FileName);
}
wb.SaveAs(FileName + "Final.xlsx");
↧
New Post: InsertRowsBelow bug?
I create a sheet and named 'Settings' and named the cell 'A1:B1' is '_TestMergeClone'.
When I use this like (.xlsm)
workbook.Worksheet("Settings").Range("_TestMergeClone").InsertRowsBelow(10);
there no rows affect.
but when I used like
workbook.Worksheet("Settings").Range("A1").InsertRowsBelow(10);
It works well.
Something i used wrong?
And another question.
eg.
when the first row has many merged cell
and I userd InsertRowsBelow to clone some rows but the clones is not merged,
what can I do to clone the same struct rows under the first row? Thanks。
:)
When I use this like (.xlsm)
workbook.Worksheet("Settings").Range("_TestMergeClone").InsertRowsBelow(10);
there no rows affect.
but when I used like
workbook.Worksheet("Settings").Range("A1").InsertRowsBelow(10);
It works well.
Something i used wrong?
And another question.
eg.
when the first row has many merged cell
and I userd InsertRowsBelow to clone some rows but the clones is not merged,
what can I do to clone the same struct rows under the first row? Thanks。
:)
↧