summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/tools/Misc.xba35
1 files changed, 35 insertions, 0 deletions
diff --git a/wizards/source/tools/Misc.xba b/wizards/source/tools/Misc.xba
index 2bf17d32e984..7a001683c9bd 100644
--- a/wizards/source/tools/Misc.xba
+++ b/wizards/source/tools/Misc.xba
@@ -838,4 +838,39 @@ End Sub
Function CalIsLeapYear(ByVal iYear as Integer) as Boolean
CalIsLeapYear = ((iYear Mod 4 = 0) And ((iYear Mod 100 <> 0) Or (iYear Mod 400 = 0)))
End Function
+
+' Sub that fixes various issues in tables imported from DOC/DOCX
+Sub FixTableProperties
+ sumTables = 0
+ sumSplit = 0
+ sumRelativeWidth = 0
+ sumRows = 0
+ oTables = ThisComponent.TextTables
+ For i = 0 To oTables.getCount() - 1
+ oTable = oTables(i)
+ sumTables = sumTables + 1
+ If oTable.getPropertyValue("Split") = false Then
+ sumSplit = sumSplit + 1
+ oTable.setPropertyValue("Split", true)
+ End If
+ If oTable.getPropertyValue("HoriOrient") <> 6 And _
+ oTable.getPropertyValue("IsWidthRelative") = false Then
+ sumRelativeWidth = sumRelativeWidth + 1
+ oTable.setPropertyValue("RelativeWidth", 100)
+ End If
+ For j = 0 To oTable.getRows.getCount - 1
+ oRow = oTable.getRows.getByIndex(j)
+ If oRow.getPropertyValue("IsSplitAllowed") = false Then
+ sumRows = sumRows + 1
+ oRow.setPropertyValue("IsSplitAllowed", true)
+ End If
+ Next
+ Next
+
+ s = "Out of " & sumTables & " table(s)" & CHR(13) & _
+ "Relative setting was added to: " & sumRelativeWidth & CHR(13) & _
+ "Property to enable breaking across pages was enabled for: " & sumSplit & CHR(13) & CHR(13) & _
+ "No. of rows property to enable breaking across pages was enabled for: " & sumRows & CHR(13) & CHR(13) & "Save the file afterwards!"
+ MsgBox s, 0, "Result"
+End Sub
</script:module>