Place embedded spreadsheet on drawing as window

Place embedded spreadsheet on drawing as window

harvey_craig2RCUH
Advocate Advocate
270 Views
5 Replies
Message 1 of 6

Place embedded spreadsheet on drawing as window

harvey_craig2RCUH
Advocate
Advocate

I am embedding a spreadsheet on my drawing using iLogic. It embeds no problem:

 

Dim oDrawingDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oNewExcelSheet As Object = oDrawingDoc.ReferencedOLEFileDescriptors.Add("C:\TEMP\InventorCalcs\Calc21.xlsx", 3330)

Just a niggle, it appears in the model browser which is good. However, we like to have the sheet as an linked window placed to the right of the sheet. This is the default option when you do it in the UI. How do I get the window on my sheet?

 

Thanks,

Harvey

0 Likes
271 Views
5 Replies
Replies (5)
Message 2 of 6

harvey_craig2RCUH
Advocate
Advocate

Does anyone have an idea for this?

0 Likes
Message 3 of 6

marcin_otręba
Advisor
Advisor

use:

 

Public Sub CreateDrawingExcelTable()    
    ' Set a reference to the active drawing document
    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument
    
    ' Set a reference to the active sheet
    Dim oActiveSheet As Sheet
    Set oActiveSheet = oDrawDoc.ActiveSheet
    
    ' Create the placement point for the table
    Dim oPoint As Point2d
    Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(25, 25)
    
    ' Create the table by specifying the source Excel file
    ' This assumes that the first row in the Excel sheet specifies the column headers
    ' You can specify a different row using the last argument of the AddExcelTable method
    Dim oExcelTable As CustomTable
    Set oExcelTable = oActiveSheet.CustomTables.AddExcelTable("C:\Temp\test.xls", oPoint, "Excel Table")
End Sub

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 4 of 6

harvey_craig2RCUH
Advocate
Advocate

Hi,

 

I'm looking to have the spreadsheet as an emending rather than a table. Thanks for trying!

 

Cheers,

Harvey

0 Likes
Message 5 of 6

harvey_craig2RCUH
Advocate
Advocate

I have also tried making the sheet visible:

Dim oDrawingDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oNewExcelSheet As Object = oDrawingDoc.ReferencedOLEFileDescriptors.Add(TempSpreadsheetPath, 3330)
oNewExcelSheet.DisplayName = "CalcSheet"
oNewExcelSheet.Visible = True

And although this does change the variable (in the UI Visibility becomes ticked):

harvey_craig2RCUH_0-1734359008707.png

The CalcSheet does not appear as a window in the drawing area. How do I get the CalcSheet in the drawing area like it would be placed if this were done by the UI?

 

Thanks,

Harvey

0 Likes
Message 6 of 6

marcin_otręba
Advisor
Advisor

sorry, but i am pretty sure it is not possible

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes