Kaydet (Commit) 41d57bd3 authored tarafından Aron Budea's avatar Aron Budea Kaydeden (comit) Andras Timar

[cp] Updated Fix Table Properties macro

Change-Id: I7f8695789e1223df7bbb235fa6081ed91502ab99
Reviewed-on: https://gerrit.libreoffice.org/71852Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
Tested-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst 4eaff124
...@@ -841,36 +841,61 @@ End Function ...@@ -841,36 +841,61 @@ End Function
&apos; Sub that fixes various issues in tables imported from DOC/DOCX &apos; Sub that fixes various issues in tables imported from DOC/DOCX
Sub FixTableProperties Sub FixTableProperties
sumTables = 0 sumTables = 0
sumSplit = 0 sumSplit = 0
sumRelativeWidth = 0 sumRelativeWidth = 0
sumRows = 0 sumRows = 0
oTables = ThisComponent.TextTables sumPara = 0
For i = 0 To oTables.getCount() - 1 oTables = ThisComponent.TextTables
oTable = oTables(i) For i = 0 To oTables.getCount() - 1
sumTables = sumTables + 1 oTable = oTables(i)
If oTable.getPropertyValue(&quot;Split&quot;) = false Then sumTables = sumTables + 1
sumSplit = sumSplit + 1 If oTable.getPropertyValue(&quot;Split&quot;) = false Then
oTable.setPropertyValue(&quot;Split&quot;, true) sumSplit = sumSplit + 1
End If oTable.setPropertyValue(&quot;Split&quot;, true)
If oTable.getPropertyValue(&quot;HoriOrient&quot;) &lt;&gt; 6 And _ End If
oTable.getPropertyValue(&quot;IsWidthRelative&quot;) = false Then If oTable.getPropertyValue(&quot;HoriOrient&quot;) &lt;&gt; 6 And _
sumRelativeWidth = sumRelativeWidth + 1 oTable.getPropertyValue(&quot;IsWidthRelative&quot;) = false Then
oTable.setPropertyValue(&quot;RelativeWidth&quot;, 100) sumRelativeWidth = sumRelativeWidth + 1
End If oTable.setPropertyValue(&quot;RelativeWidth&quot;, 100)
For j = 0 To oTable.getRows.getCount - 1 End If
oRow = oTable.getRows.getByIndex(j) For j = 0 To oTable.getRows.getCount - 1
If oRow.getPropertyValue(&quot;IsSplitAllowed&quot;) = false Then oRow = oTable.getRows.getByIndex(j)
sumRows = sumRows + 1 If oRow.getPropertyValue(&quot;IsSplitAllowed&quot;) = false Then
oRow.setPropertyValue(&quot;IsSplitAllowed&quot;, true) sumRows = sumRows + 1
End If oRow.setPropertyValue(&quot;IsSplitAllowed&quot;, true)
Next End If
Next Next
s = &quot;Out of &quot; &amp; sumTables &amp; &quot; table(s)&quot; &amp; CHR(13) &amp; _ sNames = oTable.getCellNames()
&quot;Relative setting was added to: &quot; &amp; sumRelativeWidth &amp; CHR(13) &amp; _ For k = LBound(sNames) To UBound(sNames)
&quot;Property to enable breaking across pages was enabled for: &quot; &amp; sumSplit &amp; CHR(13) &amp; CHR(13) &amp; _ oCell = oTable.getCellByName(sNames(k))
&quot;No. of rows property to enable breaking across pages was enabled for: &quot; &amp; sumRows &amp; CHR(13) &amp; CHR(13) &amp; &quot;Save the file afterwards!&quot; cType = oCell.getType()
MsgBox s, 0, &quot;Result&quot; If oCell.getType() = com.sun.star.table.CellContentType.TEXT Then
oCellCursor = oCell.createTextCursor()
oParEnum = oCell.createEnumeration()
Do While oParEnum.hasMoreElements()
oPar = oParEnum.nextElement()
leftMargin = oPar.getPropertyValue(&quot;ParaLeftMargin&quot;)
rightMargin = oPar.getPropertyValue(&quot;ParaRightMargin&quot;)
firstLineIndent = oPar.getPropertyValue(&quot;ParaFirstLineIndent&quot;)
&apos;If any are &lt; 0, consider bad, and reset all to 0
If leftMargin &lt; 0 Or rightMargin &lt; 0 Or firstLineIndent &lt; 0 Then
sumPara = sumPara + 1
oPar.setPropertyValue(&quot;ParaLeftMargin&quot;, 0)
oPar.setPropertyValue(&quot;ParaRightMargin&quot;, 0)
oPar.setPropertyValue(&quot;ParaFirstLineIndent&quot;, 0)
End If
Loop
End If
Next
Next
s = &quot;Out of &quot; &amp; sumTables &amp; &quot; table(s)&quot; &amp; CHR(13) &amp; _
&quot;Relative setting was added to: &quot; &amp; sumRelativeWidth &amp; CHR(13) &amp; _
&quot;Property to enable breaking across pages was enabled for: &quot; &amp; sumSplit &amp; CHR(13) &amp; CHR(13) &amp; _
&quot;No. of rows property to enable breaking across pages was enabled for: &quot; &amp; sumRows &amp; CHR(13) &amp; _
&quot;No. of paragraphs in cells where paragraph properties were reset: &quot; &amp; sumPara &amp; CHR(13) &amp; CHR(13) &amp; &quot;Save the file afterwards!&quot;
MsgBox s, 0, &quot;Result&quot;
End Sub End Sub
</script:module> </script:module>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment