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
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.
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
Chapter 14, page 336, Listing 11 "SetValidationRange"
The two lines:
Chapter 14, page 346
The second paragraph, third sentence that says
"The autoFill() method..."
"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
which should read
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"
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)
This is a formatting error. The source code available from the publisher does not contain this error.