Forum Moderators: open

Message Too Old, No Replies

Printing To Excel

         

webdevjim

6:42 pm on Apr 15, 2004 (gmt 0)

10+ Year Member



Hello,
I'm printing the output of my .asp to excel. Is there a way to set the column widths. When I open the file the columns are overlapping by default.

Thanks,
/WebDevJim

Mephisto6

8:38 pm on Apr 15, 2004 (gmt 0)



Hi WebdevJim, in case you're still looking for this -

Not sure how you're creating the spreadsheet, but if creating an OWC object, ie:

Set theSpreadsheet = Server.CreateObject("OWC.Spreadsheet")

When looping the columns and rows, you can use:

theSpreadsheet.Columns(iColNum).columnWidth = 24.71

(or some number) to specify the width or:

theSpreadsheet.Columns(iColNum).AutoFitColumns

(to auto-fit of course).

You can also access stuff like:

'Make the column bold and underlined
theSpreadsheet.Cells(iRowNum, iColNum).Font.Bold = True
theSpreadsheet.Cells(iRowNum, iColNum).Font.Underline = True

There's a great article at [4guysfromrolla.com...] on this. Hope that helps!

M

webdevjim

10:21 am on Apr 16, 2004 (gmt 0)

10+ Year Member



Mephisto,
Thanks. I'll look into it. I'm more of a perl guy stuck working on a windows box, but I'm opening the file with the FSO object if that rings a bell.

/WebDevJim