Macros/Writer/003/es

Description
This macro manipulates the borders of either an entire table, or a single cell.

The table borders are accessible via the property ''' com.sun.star. table.TableBorder'''.

The elements of this struct have two types:
 * Borders (upper, lower, left, right, horizontal, vertical); the borders are the structs  com.sun.star. table.BorderLine2 which "add" style elements for the struct  com.sun.star. table.BorderLine.
 * Booleans (IsLeftLineValid, IsRightLineValid, IsTopLineValid, etc.). In writing, defining them as True to modify the line correspondingly, and False to ignore; meaning it keeps its current value.

The definition for spacing with the content is via the property ''' com.sun.star. table.TableBorderDistances''' of the table. This struct is manipulated via the same principle, using BottomDistance, LeftDistance, etc. and booleans for modifying the name.

The macro below is executed on the currently selected table. In the macro, we do the following:
 * We start by checking that the cursor is indeed inside a table.
 * The objective is to replace the current borders (the parameters Is... are defined as True) to obtain a an external perimeter and horizontal double lines. We don't want vertical lines. Therefore we need .IsVerticalLineValid = true and VerticalLine = LibONoLine, a struct defined for applying "empty" to a line. We cannot simply use .IsVerticalLineValid = false since the current table could have vertical lines defined and we want to suppress them. With the parameter false, the existing lines would be left in their current state.
 * The desired border width is 0.30 cm.
 * The parameter Fuse the adjacent line styles is defined by the property CollapsingBorders of the table.

Code
Border line distances and widths are expressed in 1/100 mm.

ODT file to test macro

 * [[Media:Example macro for table border manipulation.odt|Download example ODT file with this macro included]]