Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
NOTE from JSOP: No, he is not using Excel.Interop. He's using something called ClosedXML - it's available here - ClosedXML - The easy way to OpenXML - Home[^]. Although his tag doesn't indicate as much, I suspect this is also for ASP.Net or MVC.

-------------------------------

Hello sorry for my english. I have to select a row of a excel file, put any new data and save them. In the end I see that the excel file is always larger than before although the data are not increased but it looks to be created of the blank columns to the right. I think this because when I execute the following statement

C#
var wb = openWorkBook(filename);
var ws = wb.Worksheet("CNF");
IXLRow row = ws.Row(device.Ordinal - 1 + FirstRow);
for (int j = 0; j < 100; ++j)
{
IXLCell cell = row.Cell(j + FirstCol);
...}


as range goes from A1 to XFD1048576. Although after I take the line of my interest and cycle of 100 columns when I go

F#
wb.Save();


the file increases.
In the file it seems to be created empty right columns that increase the file size.
If I then draw attention to the empty columns and delete the file back to its previous size.
So I ask you if you have a method to take only a part of a file then for example take already suffered from a limited number of columns, starting from education

C#
var ws = wb.Worksheet("CNF");


Thank you

What I have tried:

I tried to use the method range but not go
Posted
Updated 15-Dec-16 4:03am
v2
Comments
#realJSOP 15-Dec-16 10:06am    
Try using google translate - type your question in your native language and let google translate it to English. Copy/paste the English translation to your question. DO NOT CREATE A NEW QUESTION. Click the Improve Question link and edit your question.

1 solution

Yeah, you English isn't helping us, and I'm assuming you're using Excel.Interop to open the Excel file.

I think you need to look at the Worksheet.UsedRange property.
 
Share this answer
 
Comments
Federico Barbieri 15-Dec-16 8:57am    
No use XLWorkbook.
And in my code where I'm supposed to use your education?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900