Re-size Excel columns

R

RP

I am exporting certain records to Excel 2007 using C# code. I want to
adjust the cell width accordingly so that when the record gets
transferred to a cell, it is clearly visible.

I want to increase the height and width of the Excel cell at run-time.
 
N

Nicholas Paldino [.NET/C# MVP]

RP,

You should be able to access the column properties through the
automation model. How are you performing the export? Are you using
Automation (accessing the Application object and the Workbook/Worksheets)?

If you are exporting to 2007 (and only 2007) then you can probably forgo
the Automation model and set the width directly in the XML that makes up the
sheet. It's massive, but you can probably look in the spreadsheet ML
specification and find the element/attribute for the column width in the XML
you have to set.
 
R

RP

What is the best approach to export to Excel 2007? I am using
application object.

RP,

You should be able to access the column properties through the
automation model. How are you performing the export? Are you using
Automation (accessing the Application object and the Workbook/Worksheets)?

If you are exporting to 2007 (and only 2007) then you can probably forgo
the Automation model and set the width directly in the XML that makes up the
sheet. It's massive, but you can probably look in the spreadsheet ML
specification and find the element/attribute for the column width in the XML
you have to set.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


I am exporting certain records to Excel 2007 using C# code. I want to
adjust the cell width accordingly so that when the record gets
transferred to a cell, it is clearly visible.
I want to increase the height and width of the Excel cell at run-time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top