Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: michielper on August 06, 2018, 01:23:44 am
-
I am generating documents with diagrams in EA version 13. Package names are the paragraph headings in my document.
When a package contains a diagram that is not too large, I want the package name (paragraph header) to be on the same page as the diagram and not have a paragraph name followed by a large empty space.
So, I tried the "keep with next" option in my template. When opening the generated document in Word, however, the paragraph heading is NOT marked as "keep with next" and the paragraph heading is attached to the preceding text, is followed by a large empty space and the diagram is on the next page. Not what I want...
I also tried "keep together" but this neither works.
Has anyone else experienced the same problem and perhaps found a solution?
-
We use a word macro to
- shrink the images to the correct size so the title
- set certain styles "keep with next"
Geert
-
We use a word macro to
- shrink the images to the correct size so the title
- set certain styles "keep with next"
Geert
Yes, that seems like a work around. It is definitely a bug in EA though. Any chance of sharing that macro code?
-
This is the code for setting the keep with next on some styles:
Sub setStyles()
Dim currentStyle As style
Set currentStyle = ActiveDocument.Styles.Item("Heading 1")
currentStyle.ParagraphFormat.KeepWithNext = True
Set currentStyle = ActiveDocument.Styles.Item("Heading 2")
currentStyle.ParagraphFormat.KeepWithNext = True
Set currentStyle = ActiveDocument.Styles.Item("Heading 3")
currentStyle.ParagraphFormat.KeepWithNext = True
Set currentStyle = ActiveDocument.Styles.Item("Heading 4")
currentStyle.ParagraphFormat.KeepWithNext = True
Set currentStyle = ActiveDocument.Styles.Item("Diagram Image")
currentStyle.ParagraphFormat.KeepWithNext = True
End Sub
This one resizes images:
Sub ResizeAllImages()
Dim oILShp As InlineShape
For Each oILShp In ActiveDocument.InlineShapes
If oILShp.Height > CentimetersToPoints(23) Then
oILShp.Width = ((CSng(oILShp.Height) / CentimetersToPoints(23)) * CSng(oILShp.Width))
oILShp.Height = CentimetersToPoints(23)
End If
Next
End Sub
And this one sets the rows to allow to break across pages (useful for tables with large amounts of text)
Sub SetTableProperties()
On Error Resume Next
Dim oTbl As Table
Dim oRow As row
Dim headerRow As row
For Each oTbl In ActiveDocument.Tables
Set headerRow = oTbl.Rows(1)
If headerRow.HeadingFormat Then
For Each oRow In oTbl.Rows
oRow.AllowBreakAcrossPages = False
Next
End If
Next
End Sub
Geert
-
Thanks Geert!