Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Part list export without header

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
yvandelafontaine
1198 Views, 2 Replies

Part list export without header

How do i export a part list without the header.

this is my current code, i just need to get rid of the column heading in excel. or more precisely i need to export ONLY the value from the table.

 'check for existing XLS file and delete it if found
If Dir(path_and_name & ".xls") <> "" Then
Kill (path_and_name & ".xls")
Else
End If

'get the path and name of the drawing file
path_and_name = ThisDoc.PathAndFileName(False) ' without extension

'define oDoc
oDoc = ThisDoc.Document

'specify the drawing sheet
'oSheet = oDoc.Sheets("Sheet:1") ' sheet by name
oSheet = oDoc.Sheets(1) ' first sheet

' say there is a Partslist on the sheet.
oPartslist = oSheet.PartsLists(1)
     
' create a new NameValueMap object
oOptions = ThisApplication.TransientObjects.CreateNameValueMap

'specify an existing template file
'to use For formatting colors, fonts, etc
oOptions.Value("Template") = "C:\Temp\TemplateBOM.xls"
 
'specify the columns to export         
oOptions.Value("ExportedColumns") = "Qté (Qty)"
 
'specify the start cell
oOptions.Value("StartingCell") = "B8"
 
'specify the XLS tab name
'here the file name is used
'oOptions.Value("TableName") = ThisDoc.FileName(False) 'without extension

'choose to include the parts list title row
'in this example "Ye Old List of Parts" is written to the StartingCell
oOptions.Value("IncludeTitle") = False         
oOptions.Value("IncludeHeading") = False
'choose to autofit the column width in the xls file
oOptions.Value("AutoFitColumnWidth") = False
       
' export the Partslist to Excel with options
oPartslist.Export(path_and_name & ".xls", PartsListFileFormatEnum.kMicrosoftExcel, oOptions)  

'-------------End of ilogic ------------------------------

 I tried this: oOptions.Value("IncludeHeading") = False

but without result, any ideas???

2 REPLIES 2
Message 2 of 3

Hi,

 

I checked the Inventor API Help File, but I could not see "IncludeHeading" listed - where did you see it?

Help file: 

 

Valid inputs for Options parameter: 
Name                       Value Type           Valid for export formats 
-------------------       -----------       -------------------------------- 
TableName                 String              kMicrosoftExcel, kMicrosoftAccess 
ExportedColumns          String              All containing semicolon separated column titles 
IncludeTitle                 Boolean           kMicrosoftExcel, kTextFileCommaDelimited, kTextFileTabDelimited, kUnicodeTextFileCommaDelimited, kUnicodeTextFileTabDelimited 
StartingCell                 String              kMicrosoftExcel 
Template                    String             kMicrosoftExcel 
AutoFitColumnWidth      Boolean           kMicrosoftExcel

You would provably need to use the Excel API to either export everything by yourself or to remove the header created by the Export() method.

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 3 of 3

I haven't seen it, but i wished there was a way. since there is none, i'll work around it

 

thank you

 

Yvan De Lafontaine

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report