Help  |   Contact Us  |   About Us  |   News and Events
Books, conferences, and other information about... Moving to Linux Switching to OOo Building Linux Apps Using Visual FoxPro
Buy      Download      Your Account      Catalog      Support      Conferences      Resources      Fun

OpenOffice.org Macros Explained
Updates/FAQ/Errata

If you have a question about the technical contents of this book, please contact the author(s). Their email address(es) can usually be found in their bios in the About the Author section at the front of the book or on the author's bio page (click on the author's name on the book's main page.


Chapter 14. Calc documents - Page 355, Listing 29 - How to break a link

Frank Jarratt asked the following question: This macro, "LinkASheet", creates a sheet link. How can I remove it besides using the menu: Edit | Links?

Before investigation, I expected it to either dispose the link or remove the link from the container. It turns out that the link can be removed from the container (in a fashion), but the container is really the sheet, not the SheetLinks object. In other words, I inspected three objects before I found the answer. Each sheet supports the XSheetLinkable interface as is shown in Table 33 on page 355. There are two errors in Table 33 as shown above. If you set the link mode to NONE, then the link is broken. For the listing that you mention in the book, you could add the following code to remove the link oSheets.getByName("LinkIt").setLinkMode(com.sun.star.sheet.SheetLinkMode.NONE)

Chapter 14, page 328, the CellAddressConverter

The behavior of the CellAddressConverter, which displays a Calc cell in a human readable form, is not working as expected. In OOo version 1.1.2, the UserInterfaceRepresentation property does not contain the contains the sheet name if the cell is in Sheet1, and it does if the cell is in any other sheet. An issue has been created in Issuezilla to track this discrepency (see http://www.openoffice.org/issues/show_bug.cgi?id=32817). I modified Listing 5 on page 328 to reflect these changes and I converted the listing to be subroutine rather than just a stub.

Sub DemoCellAddressConversion
Dim oConv
Dim oCell
oConv = ThisComponent.CreateInstance("com.sun.star.table.CellAddressConversion")
oCell = ThisComponent.Sheets(2).getCellByPosition(0,0) 'Cell Sheet3.A1
oConv.Address = oCell.getCellAddress()
Print oConv.UserInterfaceRepresentation 'Sheet3.A1
Print oConv.PersistentRepresentation 'Sheet3.A1
End Sub


Chapter 14, page 336, Listing 11 "SetValidationRange"

The two lines:
Validation.setFormula1(1.0)
Validation.setFormula1(10.0)
Should read:
Validation.setFormula1(1.0)
Validation.setFormula2(10.0)


Chapter 14, page 346

The second paragraph, third sentence that says
"The autoFill() method..."
should be
"The fillAuto() method..."

Chapter 14, page 355, Table 33

The heading for Table 33 should read
"Table 33. Methods defined by the XSheetLinkable interface."

Also, the table lists the method
"getLinkMode(SheetLinkMode)"
which should read
"setLinkMode(SheetLinkMode)"

Chapter 14, page 355, Listing 29 "LinkASheet"

An extra forward slash is required in the URL. Change
sURL = "file://C:/My%20Documents/CH15/test.sxc"
to
sURL = "file:///C:/My%20Documents/CH15/test.sxc"

Chapter 14, page 356, Listing 29

This listing requires a line break. It starts on page 355 and ends on page 356. The last line of the listing reads as follows:

oSheet.link(sURL, "Sheet1", "", "", com.sun.star.sheet.SheetLinkMode.NORMAL) End Sub
This should read as follows:
oSheet.link(sURL, "Sheet1", "", "", com.sun.star.sheet.SheetLinkMode.NORMAL)
End Sub

This is a formatting error. The source code available from the publisher does not contain this error.