PDA

View Full Version : Make a contactsheet (maxscript to excel)


ricozone
10-22-2009, 04:49 PM
Hi,

I'm searching a way to create, write and save via maxscript a excel (.xls) file. I know that i can open excel file via OLEobject but i don't know how to format and save it.

For example, i want to create a contactsheet of all objects in a scene
for each xls line --> put the preview (.jpg file) and the name of current object.
So cell A1= preview, cell B1= string name... and so on for each object.

I can't find documentation on how to format data for .xls filetype.
And, is there a way to put in excel (maybe via clipboard) a rendered image ?


xl = createOLEObject "Excel.Sheet"

for n=1 to objs.count do(

cell_prev = xl.application.cells n 1 --get the cell A1
cell_name = xl.application.cells n 2 --get the cell B1

-- make the preview of current object, i have a function to do it
pastedImg = object render as a bitmap


cell_prev.value = pastedImg
cell_name.value = objs[n].name


)--end loop on array

-- save the xls file to a filename string like @"c:\obj_list.xls"
??????????

-- close the xls file
releaseOLEObject xl


Thanks for your advices

PEN
10-22-2009, 06:24 PM
One thing that I have done is just write it out to a CSV file and import that into Excel.

ricozone
10-22-2009, 06:55 PM
thanks PEN, you're right.

But i'd like to put an image into that file, not the path of this image....don't know if it's possible ?
.CSV file can not handle a picture while .XLS can.

Maybe i'd rather go with a HTML output format instead of making a .XSL

PEN
10-22-2009, 07:14 PM
Or you could use a XML format and read that in to a browser using JS.

CGTalk Moderation
10-22-2009, 07:14 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.