From b2caf339c405a8d2fc143a0ba945a9166e782d1f Mon Sep 17 00:00:00 2001 From: Rafael Lima Date: Sun, 19 Jun 2022 18:17:31 +0200 Subject: Document new ExportRangeToFile method of the Calc service This patch also clarifies the use of single quotes in sheet names. Change-Id: I6a0f3b62b74d7443144d7957ae5478196580bec8 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/136120 Tested-by: Jenkins Reviewed-by: Alain Romedenne (cherry picked from commit 9a5b8988ad5e005b3a92038d51c6b07c44b7b79c) Reviewed-on: https://gerrit.libreoffice.org/c/help/+/136700 Reviewed-by: Jean-Pierre Ledure --- source/text/sbasic/shared/03/sf_calc.xhp | 55 ++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/text/sbasic/shared/03/sf_calc.xhp b/source/text/sbasic/shared/03/sf_calc.xhp index 738b9017f8..6b75f86ddd 100644 --- a/source/text/sbasic/shared/03/sf_calc.xhp +++ b/source/text/sbasic/shared/03/sf_calc.xhp @@ -124,7 +124,16 @@ Either a string designating a set of contiguous cells located in a sheet of the current instance or an object produced by the .Range property. The shortcut "~" (tilde) represents the current selection or the first selected range if multiple ranges are selected. The shortcut "*" represents all used cells. - The sheet name is optional in a range (default = the active sheet). Surrounding single quotes and $ signs are allowed but ignored. + The sheet name is optional when defining a range. If no sheet name is provided, then the active sheet is used. Surrounding single quotes and $ signs are allowed but ignored. + When specifying a SheetName as a string, the use of single quotes to enclose the sheet name are required if the name contains blank spaces " " or periods ".". + The examples below illustrate in which cases the use of single quotes is mandatory: + + ' The use of single quotes is optional + oDoc.clearAll("SheetA.A1:B10") + oDoc.clearAll("'SheetA'.A1:B10") + ' The use of single quotes is required + oDoc.clearAll("'Sheet.A'.A1:B10") + Except for the CurrentSelection property, the Calc service considers only single ranges of cells. @@ -134,7 +143,7 @@ - 1) '$SheetX'.D2
2) $D$2
+ 1) $'SheetX'.D2
2) $D$2
A single cell @@ -142,7 +151,7 @@
- 1) '$SheetX'.D2:F6
2) D2:D10
+ 1) $'SheetX'.D2:F6
2) D2:D10
Single range with multiple cells @@ -150,7 +159,7 @@
- '$SheetX'.* + $'SheetX'.* All used cells in the given sheet @@ -158,7 +167,7 @@ - 1) '$SheetX'.A:A (column A)
2) 3:5 (rows 3 to 5)
+ 1) $'SheetX'.A:A (column A)
2) 3:5 (rows 3 to 5)
All cells in contiguous columns or rows up to the last used cell @@ -543,6 +552,7 @@ DMax
DMin
DSum
+ ExportRangeToFile
Forms
GetColumnName
GetFormula
@@ -552,7 +562,7 @@ InsertSheet
MoveRange
MoveSheet
- Offset

+ Offset
@@ -1145,6 +1155,39 @@ Cells in the given range that contain text will be ignored by all of these functions. For example, the DCount method will not count cells with text, only numerical cells. +
+ ExportRangeToFile --------------------------------------------------------------------------------------- + + Calc service;ExportRangeToFile + +

ExportRangeToFile

+ Exports the specified range as an image or PDF file. + This method returns True if the destination file was successfully saved. + Hidden rows or columns in the specified range are not exported to the destination file. + + + svc.ExportRangeToFile(range: str, filename: str, imagetype: str = "pdf", overwrite: bool = False): bool + + + range: A sheet name or a cell range to be exported, as a string. + filename: The name of the file to be saved. It must follow the SF_FileSystem.FileNaming notation. + imagetype: Identifies the destination file type. Possible values are "jpeg", "pdf" (default) and "png". + overwrite: When set to True, the destination file may be overwritten (Default = False). + + + + ' Exports the entire sheet as a PDF file + oDoc.ExportRangeToFile("SheetX", "C:\Temp\image.pdf") + ' Exports the range as a PNG file and overwrites the destination file if it exists + oDoc.ExportRangeToFile("SheetX.A1:D10", "C:\Temp\image.png", "png", Overwrite := True) + + + + doc.ExportRangeToFile("SheetX", r"C:\Temp\image.pdf") + doc.ExportRangeToFile("SheetX.A1:D10", r"C:\Temp\image.png", "png", overwrite = True) + +
+
Forms ------------------------------------------------------------------------------------------- -- cgit