Pardon me butting in without reading all of Midnight's very generous reply, but here is some VB code that I think does do what you want - see pasteDiagram():
Sub DumpDiagrams(Package As Object, Ratio As Integer, bBorder As Boolean, ElementId As Long, Header As Boolean)
'______________________________________________
'
'Dump Diagrams
'
'______________________________________________
Dim idx As Integer, diag As Ea.Diagram
For Each diag In Package.Diagrams
' Check if the diagram is directly under the package - don't print if not
If diag.ParentId = ElementId Then
If Header Then
' get the Package name and comments
WriteLin diag.Name, False, False, "H2"
WriteLin diag.Notes, False, False, "NS"
End If
' Place the diagram on the document
PasteDiagram diag.DiagramGUID, Ratio, bBorder
WriteLin "Figure " + Str(iFigure) + ": " + diag.Name, True, False, "NS"
iFigure = iFigure + 1
EaRepos.CloseDiagram (diag.DiagramID)
End If
Next
Set diag = Nothing
End Sub
Public Sub PasteDiagram(sDiagGuid As String, Ratio As Integer, bBorder As Boolean)
Dim oProject As Ea.Project
Dim CurrRange As Range
Set CurrRange = WordApp.ActiveDocument.Content
CurrRange.Collapse Direction:=wdCollapseEnd
' set up a project object to retrieve the graphics
Set oProject = EaRepos.GetProjectInterface()
'Copy diiagram from EA to the Clipboard
WordApp.ActiveDocument.Content.InsertParagraphAfter
' Paste this diagram to the document from the project Object using guid from package
If oProject.PutDiagramImageOnClipboard(sDiagGuid, 0) Then
CurrRange.Paste
End If
If Ratio > 0 Then
' Selection.InlineShapes(1).Height * (Ratio / 100)
WordApp.ActiveDocument.InlineShapes(iFigure - 1).LockAspectRatio = True
WordApp.ActiveDocument.InlineShapes(iFigure - 1).Width = WordApp.ActiveDocument.InlineShapes(iFigure - 1).Width * Ratio
End If
If bBorder Then
WordApp.ActiveDocument.InlineShapes(iFigure - 1).Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
WordApp.ActiveDocument.InlineShapes(iFigure - 1).Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
WordApp.ActiveDocument.InlineShapes(iFigure - 1).Borders(wdBorderRight).LineStyle = wdLineStyleSingle
WordApp.ActiveDocument.InlineShapes(iFigure - 1).Borders(wdBorderTop).LineStyle = wdLineStyleSingle
End If
WordApp.ActiveDocument.Content.InsertParagraphAfter
Set oProject = Nothing
Set CurrRange = Nothing
End Sub
The full code for this is downloadable from the main Sparx web site dealing with Automation code:
http://www.sparxsystems.com.au/resources/developers/autint_vb.html