Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If (@error > 0) Then _ERROR #44

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
32 changes: 16 additions & 16 deletions Examples/_LOWriter_CellBackColor.au3
Original file line number Diff line number Diff line change
Expand Up @@ -11,73 +11,73 @@ Func Example()

; Create a New, visible, Blank Libre Office Document.
$oDoc = _LOWriter_DocCreate(True, False)
If (@error > 0) Then _ERROR("Failed to Create a new Writer Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to Create a new Writer Document. Error:" & @error & " Extended:" & @extended)

; Retrieve the document view cursor to insert text with.
$oViewCursor = _LOWriter_DocGetViewCursor($oDoc)
If (@error > 0) Then _ERROR("Failed to retrieve the View Cursor Object for the Writer Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve the View Cursor Object for the Writer Document. Error:" & @error & " Extended:" & @extended)

; Create the Table, 2 rows, 2 columns
$oTable = _LOWriter_TableCreate($oDoc, 2, 2)
If (@error > 0) Then _ERROR("Failed to create Text Table. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to create Text Table. Error:" & @error & " Extended:" & @extended)

; Insert the Table into the document.
$oTable = _LOWriter_TableInsert($oDoc, $oViewCursor, $oTable)
If (@error > 0) Then _ERROR("Failed to insert Text Table. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to insert Text Table. Error:" & @error & " Extended:" & @extended)

; Retrieve top left ("A1") Table Cell Object
$oCell = _LOWriter_TableGetCellObjByName($oTable, "A1")
If (@error > 0) Then _ERROR("Failed to retrieve Text Table cell Object. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve Text Table cell Object. Error:" & @error & " Extended:" & @extended)

; Retrieve current BackGround Color and Back Transparent settings. Return will be an Array with elements in order of function parameters.
$aCellBackGround = _LOWriter_CellBackColor($oCell)
If (@error > 0) Then _ERROR("Failed to retrieve current Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve current Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)

MsgBox($MB_OK, "", "I will now demonstrate modifying a cell's background color settings. The current Background color value is: " & $aCellBackGround[0] & _
@CRLF & " And the current Background Transparency setting is: " & $aCellBackGround[1])

; Set the cell Background color to $LOW_COLOR_INDIGO, and BackTransparent to False.
_LOWriter_CellBackColor($oCell, $LOW_COLOR_INDIGO, False)
If (@error > 0) Then _ERROR("Failed to set Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)

; Set Table Cell's Text.
_LOWriter_CellString($oCell, "Text with a colorful background.")
If (@error > 0) Then _ERROR("Failed to set Text Table cell text. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table cell text. Error:" & @error & " Extended:" & @extended)

; Retrieve current BackGround Color and Back Transparent settings.
$aCellBackGround = _LOWriter_CellBackColor($oCell)
If (@error > 0) Then _ERROR("Failed to retrieve current Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve current Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)

MsgBox($MB_OK, "", "I have set the cell's background color to $LOW_COLOR_INDIGO. The current Background color value is: " & $aCellBackGround[0] & _
@CRLF & " And the current Background Transparency setting is: " & $aCellBackGround[1])

; Set the cell BackTransparent to True.
_LOWriter_CellBackColor($oCell, Null, True)
If (@error > 0) Then _ERROR("Failed to set Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)

; Set Table Cell's Text.
_LOWriter_CellString($oCell, "Text without a colorful background.")
If (@error > 0) Then _ERROR("Failed to set Text Table cell text. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table cell text. Error:" & @error & " Extended:" & @extended)

; Retrieve current BackGround Color and Back Transparent settings.
$aCellBackGround = _LOWriter_CellBackColor($oCell)
If (@error > 0) Then _ERROR("Failed to retrieve current Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve current Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)

MsgBox($MB_OK, "", "I have set the cell's background transparent setting to True, which means the color will not be visible. " & _
"The current Background color value is: " & $aCellBackGround[0] & _
@CRLF & " And the current Background Transparency setting is: " & $aCellBackGround[1])

; Set the cell Background color to a random number, and BackTransparent to False.
_LOWriter_CellBackColor($oCell, Random(0, 16777215, $iIntegerFlag), False)
If (@error > 0) Then _ERROR("Failed to set Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)

; Set Table Cell's Text.
_LOWriter_CellString($oCell, "Text with a random colorful background.")
If (@error > 0) Then _ERROR("Failed to set Text Table cell text. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table cell text. Error:" & @error & " Extended:" & @extended)

; Retrieve current BackGround Color and Back Transparent settings.
$aCellBackGround = _LOWriter_CellBackColor($oCell)
If (@error > 0) Then _ERROR("Failed to retrieve current Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve current Text Table Cell Background settings. Error:" & @error & " Extended:" & @extended)

MsgBox($MB_OK, "", "I have set the cell's background color to a random number, and the background transparent setting to False." & _
"The current Background color value is: " & $aCellBackGround[0] & _
Expand All @@ -87,7 +87,7 @@ Func Example()

; Close the document.
_LOWriter_DocClose($oDoc, False)
If (@error > 0) Then _ERROR("Failed to close opened L.O. Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to close opened L.O. Document. Error:" & @error & " Extended:" & @extended)

EndFunc

Expand Down
18 changes: 9 additions & 9 deletions Examples/_LOWriter_CellBorderColor.au3
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ Func Example()

; Create a New, visible, Blank Libre Office Document.
$oDoc = _LOWriter_DocCreate(True, False)
If (@error > 0) Then _ERROR("Failed to Create a new Writer Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to Create a new Writer Document. Error:" & @error & " Extended:" & @extended)

; Retrieve the document view cursor to insert text with.
$oViewCursor = _LOWriter_DocGetViewCursor($oDoc)
If (@error > 0) Then _ERROR("Failed to retrieve the View Cursor Object for the Writer Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve the View Cursor Object for the Writer Document. Error:" & @error & " Extended:" & @extended)

; Create the Table, 2 rows, 2 columns
$oTable = _LOWriter_TableCreate($oDoc, 2, 2)
If (@error > 0) Then _ERROR("Failed to create Text Table. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to create Text Table. Error:" & @error & " Extended:" & @extended)

; Insert the Table into the document.
$oTable = _LOWriter_TableInsert($oDoc, $oViewCursor, $oTable)
If (@error > 0) Then _ERROR("Failed to insert Text Table. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to insert Text Table. Error:" & @error & " Extended:" & @extended)

; Retrieve top left ("A1") Table Cell Object
$oCell = _LOWriter_TableGetCellObjByName($oTable, "A1")
If (@error > 0) Then _ERROR("Failed to retrieve Text Table cell Object. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve Text Table cell Object. Error:" & @error & " Extended:" & @extended)

; Set the Border width so I can set the Border Color.
_LOWriter_CellBorderWidth($oCell, $LOW_BORDERWIDTH_THICK, $LOW_BORDERWIDTH_THICK, $LOW_BORDERWIDTH_THICK, $LOW_BORDERWIDTH_THICK)
If (@error > 0) Then _ERROR("Failed to set Text Table cell Border width settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table cell Border width settings. Error:" & @error & " Extended:" & @extended)

$iColor1 = Random(0, 16777215, $iIntegerFlag)
$iColor2 = Random(0, 16777215, $iIntegerFlag)
Expand All @@ -41,11 +41,11 @@ Func Example()

; Set the Border Color, a Random Color on each side.
_LOWriter_CellBorderColor($oCell, $iColor1, $iColor2, $iColor3, $iColor4)
If (@error > 0) Then _ERROR("Failed to set Text Table cell Border Color settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table cell Border Color settings. Error:" & @error & " Extended:" & @extended)

; Retrieve current Border Style settings. Return will be an array, with elements in order of function parameters.
$aCellBorder = _LOWriter_CellBorderColor($oCell)
If (@error > 0) Then _ERROR("Failed to retrieve Text Table cell Border Color settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve Text Table cell Border Color settings. Error:" & @error & " Extended:" & @extended)

MsgBox($MB_OK, "", "The current Border Color settings are: " & @CRLF & "Top = " & $aCellBorder[0] & @CRLF & "Bottom = " & $aCellBorder[1] & @CRLF & _
"Left = " & $aCellBorder[2] & @CRLF & "Right = " & $aCellBorder[3])
Expand All @@ -54,7 +54,7 @@ Func Example()

; Close the document.
_LOWriter_DocClose($oDoc, False)
If (@error > 0) Then _ERROR("Failed to close opened L.O. Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to close opened L.O. Document. Error:" & @error & " Extended:" & @extended)

EndFunc

Expand Down
24 changes: 12 additions & 12 deletions Examples/_LOWriter_CellBorderPadding.au3
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,53 @@ Func Example()

; Create a New, visible, Blank Libre Office Document.
$oDoc = _LOWriter_DocCreate(True, False)
If (@error > 0) Then _ERROR("Failed to Create a new Writer Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to Create a new Writer Document. Error:" & @error & " Extended:" & @extended)

; Retrieve the document view cursor to insert text with.
$oViewCursor = _LOWriter_DocGetViewCursor($oDoc)
If (@error > 0) Then _ERROR("Failed to retrieve the View Cursor Object for the Writer Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve the View Cursor Object for the Writer Document. Error:" & @error & " Extended:" & @extended)

; Create the Table, 5 rows, 3 columns
$oTable = _LOWriter_TableCreate($oDoc, 5, 3)
If (@error > 0) Then _ERROR("Failed to create Text Table. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to create Text Table. Error:" & @error & " Extended:" & @extended)

; Insert the Table into the document.
$oTable = _LOWriter_TableInsert($oDoc, $oViewCursor, $oTable)
If (@error > 0) Then _ERROR("Failed to insert Text Table. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to insert Text Table. Error:" & @error & " Extended:" & @extended)

; Retrieve Array of Cell names.
$asCellNames = _LOWriter_TableGetCellNames($oTable)
If (@error > 0) Then _ERROR("Failed to retrieve Text Table Cell names. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve Text Table Cell names. Error:" & @error & " Extended:" & @extended)

; Insert Cell names
For $i = 0 To UBound($asCellNames) - 1
; Retrieve each cell by name as returned in the table
$oCell = _LOWriter_TableGetCellObjByName($oTable, $asCellNames[$i])
If (@error > 0) Then _ERROR("Failed to retrieve Text Table Cell by name. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve Text Table Cell by name. Error:" & @error & " Extended:" & @extended)

; Set each Cell text String to each Cell's name.
_LOWriter_CellString($oCell, $asCellNames[$i])
If (@error > 0) Then _ERROR("Failed to set Text Table Cell String. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table Cell String. Error:" & @error & " Extended:" & @extended)
Next

; Retrieve 2nd down. 2nd over ("B2") Table Cell Object
$oCell = _LOWriter_TableGetCellObjByName($oTable, "B2")
If (@error > 0) Then _ERROR("Failed to retrieve Text Table cell Object. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve Text Table cell Object. Error:" & @error & " Extended:" & @extended)

; Set the Border width so I can set Border padding.
_LOWriter_CellBorderWidth($oCell, $LOW_BORDERWIDTH_THICK, $LOW_BORDERWIDTH_THICK, $LOW_BORDERWIDTH_THICK, $LOW_BORDERWIDTH_THICK)
If (@error > 0) Then _ERROR("Failed to set Text Table cell Border width settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table cell Border width settings. Error:" & @error & " Extended:" & @extended)

; Convert 1/4 Inch to Micrometers.
$iMicrometers = _LOWriter_ConvertToMicrometer(0.25)
If (@error > 0) Then _ERROR("Failed to convert from inches to Micrometers. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to convert from inches to Micrometers. Error:" & @error & " Extended:" & @extended)

; Set cell Border padding values, 1/4 inch on all sides.
_LOWriter_CellBorderPadding($oCell, $iMicrometers, $iMicrometers, $iMicrometers, $iMicrometers)

; Retrieve current Border Padding settings. Return will be an Array, with Array elements in order of function parameters.
$aCellBorder = _LOWriter_CellBorderPadding($oCell)
If (@error > 0) Then _ERROR("Failed to retrieve Text Table cell Border Padding settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve Text Table cell Border Padding settings. Error:" & @error & " Extended:" & @extended)

MsgBox($MB_OK, "", "The current Cell Border padding settings are: " & @CRLF & _
"Top = " & $aCellBorder[0] & " Micrometers" & @CRLF & _
Expand All @@ -70,7 +70,7 @@ Func Example()

; Close the document.
_LOWriter_DocClose($oDoc, False)
If (@error > 0) Then _ERROR("Failed to close opened L.O. Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to close opened L.O. Document. Error:" & @error & " Extended:" & @extended)

EndFunc

Expand Down
20 changes: 10 additions & 10 deletions Examples/_LOWriter_CellBorderStyle.au3
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,39 @@ Func Example()

; Create a New, visible, Blank Libre Office Document.
$oDoc = _LOWriter_DocCreate(True, False)
If (@error > 0) Then _ERROR("Failed to Create a new Writer Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to Create a new Writer Document. Error:" & @error & " Extended:" & @extended)

; Retrieve the document view cursor to insert text with.
$oViewCursor = _LOWriter_DocGetViewCursor($oDoc)
If (@error > 0) Then _ERROR("Failed to retrieve the View Cursor Object for the Writer Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve the View Cursor Object for the Writer Document. Error:" & @error & " Extended:" & @extended)

; Create the Table, 2 rows, 2 columns
$oTable = _LOWriter_TableCreate($oDoc, 2, 2)
If (@error > 0) Then _ERROR("Failed to create Text Table. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to create Text Table. Error:" & @error & " Extended:" & @extended)

; Insert the Table into the document.
$oTable = _LOWriter_TableInsert($oDoc, $oViewCursor, $oTable)
If (@error > 0) Then _ERROR("Failed to insert Text Table. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to insert Text Table. Error:" & @error & " Extended:" & @extended)

; Retrieve top left ("A1") Table Cell Object
$oCell = _LOWriter_TableGetCellObjByName($oTable, "A1")
If (@error > 0) Then _ERROR("Failed to retrieve Text Table cell Object. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve Text Table cell Object. Error:" & @error & " Extended:" & @extended)

; Set the Border width so I can set the Border Style.
_LOWriter_CellBorderWidth($oCell, $LOW_BORDERWIDTH_THICK, $LOW_BORDERWIDTH_THICK, $LOW_BORDERWIDTH_THICK, $LOW_BORDERWIDTH_THICK)
If (@error > 0) Then _ERROR("Failed to set Text Table cell Border width settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table cell Border width settings. Error:" & @error & " Extended:" & @extended)

; Set the Border Style, a different style on each side.
_LOWriter_CellBorderStyle($oCell, $LOW_BORDERSTYLE_DOTTED, $LOW_BORDERSTYLE_DASHED, $LOW_BORDERSTYLE_DASH_DOT_DOT, $LOW_BORDERSTYLE_THICKTHIN_SMALLGAP)
If (@error > 0) Then _ERROR("Failed to set Text Table cell Border Style settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table cell Border Style settings. Error:" & @error & " Extended:" & @extended)

; Set Table Cell's Text.
_LOWriter_CellString($oCell, "Text inside the Cell's styled borders.")
If (@error > 0) Then _ERROR("Failed to set Text Table cell text. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to set Text Table cell text. Error:" & @error & " Extended:" & @extended)

; Retrieve current Border Style settings. Return will be an Array, with elements in order of function parameters.
$aCellBorder = _LOWriter_CellBorderStyle($oCell)
If (@error > 0) Then _ERROR("Failed to retrieve Text Table cell Border Style settings. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to retrieve Text Table cell Border Style settings. Error:" & @error & " Extended:" & @extended)

MsgBox($MB_OK, "", "The current Border Style settings are: " & @CRLF & "Top = " & $aCellBorder[0] & @CRLF & "Bottom = " & $aCellBorder[1] & @CRLF & _
"Left = " & $aCellBorder[2] & @CRLF & "Right = " & $aCellBorder[3] & @CRLF & @CRLF & "see Constants in UDF for value meanings.")
Expand All @@ -51,7 +51,7 @@ Func Example()

; Close the document.
_LOWriter_DocClose($oDoc, False)
If (@error > 0) Then _ERROR("Failed to close opened L.O. Document. Error:" & @error & " Extended:" & @extended)
If @error Then _ERROR("Failed to close opened L.O. Document. Error:" & @error & " Extended:" & @extended)

EndFunc

Expand Down
Loading