source/text/sbasic/shared/03/sf_calc.xhp | 234 +++++++++++++++++++++++++------ 1 file changed, 196 insertions(+), 38 deletions(-)
New commits: commit 94e3719169db094d5efd3a952461bd08a806f0f7 Author: Rafael Lima <rafael.palma.l...@gmail.com> AuthorDate: Thu Oct 28 19:20:47 2021 +0200 Commit: Rafael Lima <rafael.palma.l...@gmail.com> CommitDate: Mon Nov 1 13:51:28 2021 +0100 Update SF_Calc service help page This patch documents the properties "Region" and "XSheetCellCursor", as well as the new methods "A1Style", "CreateChart" and "Charts". Change-Id: Ia3a5be356271ac0bb1d298de31f1d3d270f9382e Reviewed-on: https://gerrit.libreoffice.org/c/help/+/124199 Tested-by: Jenkins Reviewed-by: Rafael Lima <rafael.palma.l...@gmail.com> diff --git a/source/text/sbasic/shared/03/sf_calc.xhp b/source/text/sbasic/shared/03/sf_calc.xhp index 1dbf6c509..ed0bcda04 100644 --- a/source/text/sbasic/shared/03/sf_calc.xhp +++ b/source/text/sbasic/shared/03/sf_calc.xhp @@ -317,6 +317,23 @@ <paragraph id="par_id571591025591367" role="tablecontent" xml-lang="en-US">A range reference that can be used as argument of methods like <literal>CopyToRange</literal></paragraph> </tablecell> </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id52159102559323" role="tablecontent" xml-lang="en-US" localize="false">Region</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id81591025591007" role="tablecontent" xml-lang="en-US">Yes</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id561591025592149" role="tablecontent" xml-lang="en-US">RangeName As String</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id311591025591078" role="tablecontent" xml-lang="en-US" localize="false">String</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id571591025599937" role="tablecontent" xml-lang="en-US">Returns the address of the smallest area that contains the specified range so that the area is surrounded by empty cells or sheet edges. This is equivalent to applying the <keycode>Ctrl + *</keycode> shortcut to the given range.</paragraph> + </tablecell> + </tablerow> <tablerow> <tablecell> <paragraph id="par_id17159102559142" role="tablecontent" xml-lang="en-US" localize="false">Sheet</paragraph> @@ -385,6 +402,23 @@ <paragraph id="par_id321592315404430" role="tablecontent" xml-lang="en-US">A <literal>com.sun.star.Table.XCellRange</literal> UNO object</paragraph> </tablecell> </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id961592315565332" role="tablecontent">XSheetCellCursor</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id501592315567199" role="tablecontent">Yes</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id411592315560025" role="tablecontent">RangeName As String</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id521592315565365" role="tablecontent" localize="false">Object</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id41592315565185" role="tablecontent">A <literal>com.sun.star.sheet.XSheetCellCursor</literal> UNO object. After moving the cursor, the resulting range address can be accessed through the <literal>AbsoluteName</literal> UNO property of the cursor object, which returns a string value that can be used as argument for properties and methods of the Calc service.</paragraph> + </tablecell> + </tablerow> <tablerow> <tablecell> <paragraph id="par_id961592315565156" role="tablecontent" xml-lang="en-US" localize="false">XSpreadsheet</paragraph> @@ -399,12 +433,12 @@ <paragraph id="par_id521592315565269" role="tablecontent" xml-lang="en-US" localize="false">Object</paragraph> </tablecell> <tablecell> - <paragraph id="par_id41592315565185" role="tablecontent" xml-lang="en-US">A <literal>com.sun.star.sheet.XSpreadsheet</literal> UNO object</paragraph> + <paragraph id="par_id41592315560095" role="tablecontent" xml-lang="en-US">A <literal>com.sun.star.sheet.XSpreadsheet</literal> UNO object</paragraph> </tablecell> </tablerow> </table> - <tip id="par_id321611613059105">Visit LibreOffice API Documentation's website to learn more about <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1table_1_1XCellRange.html" name="XCellRange API">XCellRange</link> and <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XSpreadsheet.html" name="XSpreadsheet API">XSpreadsheet</link> UNO objects.</tip> + <tip id="par_id321611613059105">Visit LibreOffice API Documentation's website to learn more about <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1table_1_1XCellRange.html" name="XCellRange API">XCellRange</link>, <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XSheetCellCursor.html" name="XSheetCellCursor API">XSheetCellCursor</link> and <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XSpreadsheet.html" name="XSpreadsheet API">XSpreadsheet</link> UNO objects.</tip> <h2 id="hd_id501582887473754" xml-lang="en-US">Methods</h2> <table id="tab_id501611613601554"> @@ -414,7 +448,9 @@ <tablerow> <tablecell> <paragraph id="par_id891611613601556" role="tablecontent" localize="false"> + <link href="text/sbasic/shared/03/sf_calc.xhp#A1Style" name="A1Style method">A1Style</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#Activate" name="Activate method">Activate</link><br/> + <link href="text/sbasic/shared/03/sf_calc.xhp#Charts" name="Charts method">Charts</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#ClearAll" name="ClearAll method">ClearAll</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#ClearFormats" name="ClearFormats method">ClearFormats</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#ClearValues" name="ClearValues method">ClearValues</link><br/> @@ -422,12 +458,13 @@ <link href="text/sbasic/shared/03/sf_calc.xhp#CopySheetFromFile" name="CopySheetFromFile method">CopySheetFromFile</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#CopyToCell" name="CopyToCell method">CopyToCell</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#CopyToRange" name="CopyToRange method">CopyToRange</link><br/> - <link href="text/sbasic/shared/03/sf_calc.xhp#DAvg" name="DAvg method">DAvg</link><br/> - <link href="text/sbasic/shared/03/sf_calc.xhp#DAvg" name="DCount method">DCount</link><br/> + <link href="text/sbasic/shared/03/sf_calc.xhp#CreateChart" name="CreateChart method">CreateChart</link><br/> </paragraph> </tablecell> <tablecell> <paragraph id="par_id541611613601554" role="tablecontent" localize="false"> + <link href="text/sbasic/shared/03/sf_calc.xhp#DAvg" name="DAvg method">DAvg</link><br/> + <link href="text/sbasic/shared/03/sf_calc.xhp#DAvg" name="DCount method">DCount</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#DAvg" name="DMax method">DMax</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#DAvg" name="DMin method">DMin</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#DAvg" name="DSum method">DSum</link><br/> @@ -437,11 +474,11 @@ <link href="text/sbasic/shared/03/sf_calc.xhp#GetValue" name="GetValue method">GetValue</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#ImportFromCSVFile" name="ImportFromCSVFile method">ImportFromCSVFile</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#ImportFromDatabase" name="ImportFromDatabase method">ImportFromDatabase</link><br/> - <link href="text/sbasic/shared/03/sf_calc.xhp#InsertSheet" name="InsertSheet method">InsertSheet</link><br/> </paragraph> </tablecell> <tablecell> <paragraph id="par_id701611613601554" role="tablecontent" localize="false"> + <link href="text/sbasic/shared/03/sf_calc.xhp#InsertSheet" name="InsertSheet method">InsertSheet</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#MoveRange" name="MoveRange method">MoveRange</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#MoveSheet" name="MoveSheet method">MoveSheet</link><br/> <link href="text/sbasic/shared/03/sf_calc.xhp#Offset" name="Offset method">Offset</link><br/> @@ -457,13 +494,52 @@ </tablerow> </table> +<section id="A1Style"> + <comment> A1Style ----------------------------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id92158919969104"> + <bookmark_value>Calc service;A1Style</bookmark_value> + </bookmark> + <h2 id="hd_id201589199698251" localize="false">A1Style</h2> + <paragraph role="paragraph" id="par_id93158919969228">Returns a range address as a string based on sheet coordinates, i.e. row and column numbers.</paragraph> + <paragraph role="paragraph" id="par_id21635434153216">If only a pair of coordinates is given, then an address to a single cell is returned. Additional arguments can specify the bottom-right cell of a rectangular range.</paragraph> + <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> + <paragraph role="paragraph" localize="false" id="par_id821621534014334"> + <input>svc.A1Style(row1: int, column1: int, row2: int = 0; column2: int = 0; sheetname: str = "~"): str</input> + </paragraph> + <embed href="text/sbasic/shared/00000003.xhp#functparameters"/> + <paragraph role="paragraph" id="par_id821591631203080"><emph>row1, column1</emph>: Specify the row and column numbers of the top-left cell in the range to be considered. Row and column numbers start at 1.</paragraph> + <paragraph role="paragraph" id="par_id821591631203212"><emph>row2, column2</emph>: Specify the row and column numbers of the bottom-right cell in the range to be considered. If these arguments are not provided, or if values smaller than <literal>row1</literal> and <literal>column1</literal> are given, then the address of the single cell range represented by <literal>row1</literal> and <literal>column1</literal> is returned.</paragraph> + <paragraph role="paragraph" id="par_id821591631203336"><emph>sheetname</emph>: The name of the sheet to be appended to the returned range address. The sheet must exist. The default value is "~" corresponding to the currently active sheet.</paragraph> + <embed href="text/sbasic/shared/00000003.xhp#functexample"/> + <paragraph role="paragraph" id="par_id131611616623705">The examples below in Basic and Python consider that "Sheet1" is the currently active sheet.</paragraph> + <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/> + <bascode> + <paragraph role="bascode" localize="false" id="bas_id411589199698360">Set oDoc = CreateScriptService("Calc")</paragraph> + <paragraph role="bascode" localize="false" id="bas_id651611616531723">addr1 = oDoc.A1Style(1, 1) ' '$Sheet1'.$A$1</paragraph> + <paragraph role="bascode" localize="false" id="bas_id711611616532319">addr2 = oDoc.A1Style(2, 2, 3, 6) ' '$Sheet1'.$B$2:$F$3</paragraph> + <paragraph role="bascode" localize="false" id="bas_id181611616544988">addr3 = oDoc.A1Style(2, 2, 0, 6) ' '$Sheet1'.$B$2</paragraph> + <paragraph role="bascode" localize="false" id="bas_id181611616544911">addr4 = oDoc.A1Style(3, 4, 3, 8, "Sheet2") ' '$Sheet2'.$D$3:$H$3</paragraph> + <paragraph role="bascode" localize="false" id="bas_id181611616544104">addr5 = oDoc.A1Style(5, 1, SheetName := "Sheet3") ' '$Sheet3'.$A$5</paragraph> + </bascode> + <embed href="text/sbasic/shared/00000003.xhp#In_Python"/> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id321621534175228">doc = CreateScriptService("Calc")</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id971621534192369">addr1 = doc.A1Style(1, 1) # '$Sheet1'.$A$1</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id216215342375255">addr2 = doc.A1Style(2, 2, 3, 6) # '$Sheet1'.$B$2:$F$3</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id281635437557107">addr3 = doc.A1Style(2, 2, 0, 6) # '$Sheet1'.$B$2</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id801635437557005">addr4 = doc.A1Style(3, 4, 3, 8, "Sheet2") # '$Sheet2'.$D$3:$H$3</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id501635437602129">addr5 = doc.A1Style(5, 1, sheetname="Sheet3") # '$Sheet3'.$A$5</paragraph> + </pycode> + <tip id="par_id501611617808112">The method <literal>A1Style</literal> can be combined with any of the many properties and methods of the Calc service that require a range as argument, such as <literal>GetValue</literal>, <literal>GetFormula</literal>, <literal>ClearAll</literal>, etc.</tip> +</section> + <section id="Activate"> <comment> Activate -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id92158919969883"> - <bookmark_value>Document service;Activate</bookmark_value> + <bookmark_value>Calc service;Activate</bookmark_value> </bookmark> - <h2 id="hd_id201589199698251" localize="false">Activate</h2> - <paragraph role="paragraph" id="par_id93158919969864">If the argument <literal>SheetName</literal> is provided, the given sheet is activated and it becomes the currently selected sheet. If the argument is absent, then the document window is activated.</paragraph> + <h2 id="hd_id201589199698099" localize="false">Activate</h2> + <paragraph role="paragraph" id="par_id93158919969864">If the argument <literal>sheetname</literal> is provided, the given sheet is activated and it becomes the currently selected sheet. If the argument is absent, then the document window is activated.</paragraph> <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> <paragraph role="paragraph" localize="false" id="par_id821621534014732"> <input>svc.Activate(sheetname: str = ""): bool</input> @@ -488,10 +564,59 @@ <tip id="par_id501611617808220">Activating a sheet makes sense only if it is performed on a Calc document. To make sure you have a Calc document at hand you can use the <literal>isCalc</literal> property of the document object, which returns <literal>True</literal> if it is a Calc document and <literal>False</literal> otherwise.</tip> </section> +<section id="Charts"> + <comment> Charts ------------------------------------------------------------------------------------------------ </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id92158915960183"> + <bookmark_value>Calc service;Charts</bookmark_value> + </bookmark> + <h2 id="hd_id201589199698104" localize="false">Charts</h2> + <paragraph role="paragraph" id="par_id93158919969856">Returns either the list with the names of all chart objects in a given sheet or a single chart service instance.</paragraph> + <list type="unordered"> + <listitem> + <paragraph id="par_id371635438503202" role="listitem">If only <literal>sheetname</literal> is specified, an zero-based array of strings containing the names of all charts is returned.</paragraph> + </listitem> + <listitem> + <paragraph id="par_id371635438509045" role="listitem">If a <literal>chartname</literal> is provided, than a single object corresponding to the desired chart is returned. The specified chart must exist.</paragraph> + </listitem> + </list> + <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> + <paragraph role="paragraph" localize="false" id="par_id821621534028832"> + <input>svc.Charts(sheetname: str, chartname: str = ""): obj</input> + </paragraph> + <embed href="text/sbasic/shared/00000003.xhp#functparameters"/> + <paragraph role="paragraph" id="par_id821591631205026"><emph>sheetname</emph>: The name of the sheet from which the list of charts is to be retrieved or where the specified chart is located.</paragraph> + <paragraph role="paragraph" id="par_id821591631203566"><emph>chartname</emph>: The user-defined name of the chart object to be returned. If the chart does not have a user-defined name, then the internal object name can be used. If this argument is absent, then the list of chart names in the specified sheet is returned.</paragraph> + <tip id="par_id431635438771588">Use the <menuitem>Navigator</menuitem> sidebar to check the names assigned to charts under the <menuitem>OLE objects</menuitem> category.</tip> + <embed href="text/sbasic/shared/00000003.xhp#functexample"/> + <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/> + <paragraph role="paragraph" id="par_id41635439328174">The example below shows the number of chart objects in "Sheet1".</paragraph> + <bascode> + <paragraph role="bascode" localize="false" id="bas_id411589199698246">Dim arrNames as Object</paragraph> + <paragraph role="bascode" localize="false" id="bas_id651611616531639">arrNames = oDoc.Charts("Sheet1")</paragraph> + <paragraph role="bascode" localize="false" id="bas_id711611616532310">MsgBox "There are " & UBound(arrNames) + 1 & " charts in Sheet1"</paragraph> + </bascode> + <paragraph role="paragraph" id="par_id571635439417400">The following example accesses the chart named "MyChart" in "Sheet1" and prints its type.</paragraph> + <bascode> + <paragraph role="bascode" localize="false" id="bas_id461635439551325">Dim oChart as Object</paragraph> + <paragraph role="bascode" localize="false" id="bas_id716354395513277">oChart = oDoc.Charts("Sheet1", "MyChart")</paragraph> + <paragraph role="bascode" localize="false" id="bas_id661635439551933">MsgBox oChart.ChartType</paragraph> + </bascode> + <embed href="text/sbasic/shared/00000003.xhp#In_Python"/> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id971621534192214">bas = CreateScriptService("Basic")</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id321621534175387">chart_names = doc.Charts("Sheet1")</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id216215342375296">bas.MsgBox(f"There are {len(chart_names)} charts in Sheet1")</paragraph> + </pycode> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id421635439765634">chart = doc.Charts("Sheet1", "MyChart")</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id161635439765873">bas.MsgBox(chart.ChartType)</paragraph> + </pycode> +</section> + <section id="ClearAll"> <comment> ClearAll -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id231592919577434"> - <bookmark_value>Document service;ClearAll</bookmark_value> + <bookmark_value>Calc service;ClearAll</bookmark_value> </bookmark> <h2 id="hd_id921592919577158" localize="false">ClearAll</h2> <paragraph role="paragraph" id="par_id31592919577984">Clears all the contents and formats of the given range.</paragraph> @@ -515,7 +640,7 @@ <section id="ClearFormats"> <comment> ClearFormats -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id591592919864362"> - <bookmark_value>Document service;ClearFormats</bookmark_value> + <bookmark_value>Calc service;ClearFormats</bookmark_value> </bookmark> <h2 id="hd_id871592919864356" localize="false">ClearFormats</h2> <paragraph role="paragraph" id="par_id211592919864118">Clears the formats and styles in the given range.</paragraph> @@ -539,7 +664,7 @@ <section id="ClearValues"> <comment> ClearValues -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id781592919928644"> - <bookmark_value>Document service;ClearValues</bookmark_value> + <bookmark_value>Calc service;ClearValues</bookmark_value> </bookmark> <h2 id="hd_id111592919928265" localize="false">ClearValues</h2> <paragraph role="paragraph" id="par_id841592919928169">Clears the values and formulas in the given range.</paragraph> @@ -563,7 +688,7 @@ <section id="CopySheet"> <comment> CopySheet -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id901591631693213"> - <bookmark_value>Document service;CopySheet</bookmark_value> + <bookmark_value>Calc service;CopySheet</bookmark_value> </bookmark> <h2 id="hd_id51591631693461" localize="false">CopySheet</h2> <paragraph role="paragraph" id="par_id591591631693816">Copies a specified sheet before an existing sheet or at the end of the list of sheets. The sheet to be copied may be contained inside any <emph>open</emph> Calc document. Returns <literal>True</literal> if successful.</paragraph> @@ -605,7 +730,7 @@ <section id="CopySheetFromFile"> <comment> CopySheetFromFile -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id101591714614827"> - <bookmark_value>Document service;CopySheetFromFile</bookmark_value> + <bookmark_value>Calc service;CopySheetFromFile</bookmark_value> </bookmark> <h2 id="hd_id301591714614286" localize="false">CopySheetFromFile</h2> <paragraph role="paragraph" id="par_id931591714614755">Copies a specified sheet from a <emph>closed</emph> Calc document and pastes it before an existing sheet or at the end of the list of sheets of the file referred to by a <literal>Document</literal> object.</paragraph> @@ -634,7 +759,7 @@ <section id="CopyToCell"> <comment> CopyToCell -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id481592558768560"> - <bookmark_value>Document service;CopyToCell</bookmark_value> + <bookmark_value>Calc service;CopyToCell</bookmark_value> </bookmark> <h2 id="hd_id261592558768660" localize="false">CopyToCell</h2> <paragraph role="paragraph" id="par_id91592558768804">Copies a specified source range (values, formulas and formats) to a destination range or cell. The method reproduces the behaviour of a Copy/Paste operation from a range to a single cell.</paragraph> @@ -677,7 +802,7 @@ <section id="CopyToRange"> <comment> CopyToRange -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id171592903121677"> - <bookmark_value>Document service;CopyToRange</bookmark_value> + <bookmark_value>Calc service;CopyToRange</bookmark_value> </bookmark> <h2 id="hd_id67159290312183" localize="false">CopyToRange</h2> <paragraph role="paragraph" id="par_id1615929031212">Copies downwards and/or rightwards a specified source range (values, formulas and formats) to a destination range. The method imitates the behaviour of a Copy/Paste operation from a source range to a larger destination range.</paragraph> @@ -722,14 +847,46 @@ </pycode> </section> +<section id="CreateChart"> + <comment> CreateChart ------------------------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id171592903123257"> + <bookmark_value>Calc service;CreateChart</bookmark_value> + </bookmark> + <h2 id="hd_id67159290312287" localize="false">CreateChart</h2> + <paragraph role="paragraph" id="par_id1615929033642">Creates a new chart object showing the data in the specified range. The returned chart object can be futher manipulated using the <literal>Chart</literal> service.</paragraph> + <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> + <paragraph role="paragraph" localize="false" id="par_id981621538499667"> + <input>svc.CreateChart(chartname: str, sheetname: str, range: str, columnheader: bool = False, rowheader: bool = False): obj</input> + </paragraph> + <embed href="text/sbasic/shared/00000003.xhp#functparameters"/> + <paragraph role="paragraph" id="par_id841592903121025"><emph>chartname:</emph> The user-defined name of the chart to be created. The name must be unique in the same sheet.</paragraph> + <paragraph role="paragraph" id="par_id5515929031213680"><emph>sheetname:</emph> The name of the sheet where the chart will be placed.</paragraph> + <paragraph role="paragraph" id="par_id5515929031211522"><emph>range:</emph> The range to be used as the data source for the chart. The range may refer to any sheet of the Calc document.</paragraph> + <paragraph role="paragraph" id="par_id5515929031216390"><emph>columnheader:</emph> When <literal>True</literal>, the topmost row of the range is used as labels for the category axis or the legend (Default = <literal>False</literal>).</paragraph> + <paragraph role="paragraph" id="par_id5515929031211633"><emph>rowheader:</emph> When <literal>True</literal>, the leftmost column of the range is used as labels for the category axis or the legend. (Default = <literal>False</literal>).</paragraph> + <embed href="text/sbasic/shared/00000003.xhp#functexample"/> + <paragraph role="paragraph" id="par_id61635441176547">The examples below in Basic and Python create a chart using the data contained in the range "A1:B5" of "Sheet1" and place the chart in "Sheet2".</paragraph> + <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/> + <bascode> + <paragraph role="bascode" localize="false" id="bas_id81592903121217">Set oChart = oDoc.CreateChart("MyChart", "Sheet2", "Sheet1.A1:B5", RowHeader := True)</paragraph> + <paragraph role="bascode" localize="false" id="bas_id81592903121158">oChart.ChartType = "Donut"</paragraph> + </bascode> + <embed href="text/sbasic/shared/00000003.xhp#In_Python"/> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id761621538667188">chart = doc.CreateChart("MyChart", "Sheet2", "Sheet1.A1:B5", rowheader=True)</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id761621538664592">chart.ChartType = "Donut"</paragraph> + </pycode> + <tip id="par_id231635441342180">Refer to the help page about ScriptForge's <link href="text/sbasic/shared/03/sf_chart.xhp" name="Chart service">Chart service</link> to learn more how to further manipulate chart objects. It is possible to change properties as the chart type, chart and axes titles and chart position.</tip> +</section> + <section id="DAvg"> <comment> DAvg, DCount, DMax, DMin, DSum -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id791595777001863"> - <bookmark_value>Document service;DAvg</bookmark_value> - <bookmark_value>Document service;DCount</bookmark_value> - <bookmark_value>Document service;DMax</bookmark_value> - <bookmark_value>Document service;DMin</bookmark_value> - <bookmark_value>Document service;DSum</bookmark_value> + <bookmark_value>Calc service;DAvg</bookmark_value> + <bookmark_value>Calc service;DCount</bookmark_value> + <bookmark_value>Calc service;DMax</bookmark_value> + <bookmark_value>Calc service;DMin</bookmark_value> + <bookmark_value>Calc service;DSum</bookmark_value> </bookmark> <h2 id="hd_id471595777001777" localize="false">DAvg, DCount, DMax, DMin and DSum</h2> <paragraph role="paragraph" id="par_id601595777001498">Apply the functions Average, Count, Max, Min and Sum, respectively, to all the cells containing numeric values on a given range.</paragraph> @@ -767,7 +924,7 @@ <section id="Forms"> <comment> Forms ------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id271591632726788"> - <bookmark_value>Document service;Forms</bookmark_value> + <bookmark_value>Calc service;Forms</bookmark_value> </bookmark> <h2 id="hd_id331591632724120" localize="false">Forms</h2> <paragraph role="paragraph" id="par_id501623063693649">Depending on the parameters provided this method will return:</paragraph> @@ -780,7 +937,7 @@ </listitem> </list> <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> - <paragraph role="paragraph" localize="false" id="par_id371623063588699"> + <paragraph role="paragraph" localize="false" id="par_id371623063588128"> <input>svc.Forms(sheetname: str): str[0..*]</input> </paragraph> <paragraph role="paragraph" localize="false" id="par_id371623063588699"> @@ -809,7 +966,7 @@ <section id="GetColumnName"> <comment> GetColumnName -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id271591632726624"> - <bookmark_value>Document service;GetColumnName</bookmark_value> + <bookmark_value>Calc service;GetColumnName</bookmark_value> </bookmark> <h2 id="hd_id331591632726750" localize="false">GetColumnName</h2> <paragraph role="paragraph" id="par_id401591632726431">Converts a column number ranging between 1 and 1024 into its corresponding letter (column 'A', 'B', ..., 'AMJ'). If the given column number is outside the allowed range, a zero-length string is returned.</paragraph> @@ -836,7 +993,7 @@ <section id="GetFormula"> <comment> GetFormula -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id141593880142749"> - <bookmark_value>Document service;GetFormula</bookmark_value> + <bookmark_value>Calc service;GetFormula</bookmark_value> </bookmark> <h2 id="hd_id88159388014220" localize="false">GetFormula</h2> <paragraph role="paragraph" id="par_id921593880142573">Get the formula(s) stored in the given range of cells as a single string, a 1D or a 2D array of strings.</paragraph> @@ -861,7 +1018,7 @@ <section id="GetValue"> <comment> GetValue -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id571592231156848"> - <bookmark_value>Document service;GetValue</bookmark_value> + <bookmark_value>Calc service;GetValue</bookmark_value> </bookmark> <h2 id="hd_id471592231156242" localize="false">GetValue</h2> <paragraph role="paragraph" id="par_id331592231156425">Get the value(s) stored in the given range of cells as a single value, a 1D array or a 2D array. All values are either doubles or strings.</paragraph> @@ -886,7 +1043,7 @@ <section id="ImportFromCSVFile"> <comment> ImportFromCSVFile -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id381593685490638"> - <bookmark_value>Document service;ImportFromCSVFile</bookmark_value> + <bookmark_value>Calc service;ImportFromCSVFile</bookmark_value> </bookmark> <h2 id="hd_id151593685490480" localize="false">ImportFromCSVFile</h2> <paragraph role="paragraph" id="par_id771593685490395">Imports the contents of a CSV-formatted text file and places it on a given destination cell.</paragraph> @@ -941,7 +1098,7 @@ <section id="ImportFromDatabase"> <comment> ImportFromDatabase -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id281599568986735"> - <bookmark_value>Document service;ImportFromDatabase</bookmark_value> + <bookmark_value>Calc service;ImportFromDatabase</bookmark_value> </bookmark> <h2 id="hd_id1001599568986535" localize="false">ImportFromDatabase</h2> <paragraph role="paragraph" id="par_id881599568986824">Imports the contents of a database table, query or resultset, i.e. the result of a SELECT SQL command, inserting it on a destination cell.</paragraph> @@ -971,7 +1128,7 @@ <section id="InsertSheet"> <comment> InsertSheet -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id511591698472720"> - <bookmark_value>Document service;InsertSheet</bookmark_value> + <bookmark_value>Calc service;InsertSheet</bookmark_value> </bookmark> <h2 id="hd_id661591698472897" localize="false">InsertSheet</h2> <paragraph role="paragraph" id="par_id121591698472929">Inserts a new empty sheet before an existing sheet or at the end of the list of sheets.</paragraph> @@ -997,7 +1154,7 @@ <section id="MoveRange"> <comment> MoveRange -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id381592569476239"> - <bookmark_value>Document service;MoveRange</bookmark_value> + <bookmark_value>Calc service;MoveRange</bookmark_value> </bookmark> <h2 id="hd_id721592569476510" localize="false">MoveRange</h2> <paragraph role="paragraph" id="par_id6415925694762">Moves a specified source range to a destination range of cells. The method returns a string representing the modified range of cells. The dimension of the modified area is fully determined by the size of the source area.</paragraph> @@ -1023,7 +1180,7 @@ <section id="MoveSheet"> <comment> MoveSheet -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id561591698903617"> - <bookmark_value>Document service;MoveSheet</bookmark_value> + <bookmark_value>Calc service;MoveSheet</bookmark_value> </bookmark> <h2 id="hd_id761591698903271" localize="false">MoveSheet</h2> <paragraph role="paragraph" id="par_id831591698903829">Moves an existing sheet and places it before a specified sheet or at the end of the list of sheets.</paragraph> @@ -1049,7 +1206,7 @@ <section id="Offset"> <comment> Offset -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id29159223350681"> - <bookmark_value>Document service;Offset</bookmark_value> + <bookmark_value>Calc service;Offset</bookmark_value> </bookmark> <h2 id="hd_id61592233506228" localize="false">Offset</h2> <paragraph role="paragraph" id="par_id51592233506371">Returns a new range (as a string) offset by a certain number of rows and columns from a given range.</paragraph> @@ -1084,7 +1241,7 @@ <section id="RemoveSheet"> <comment> RemoveSheet -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id821591699085559"> - <bookmark_value>Document service;RemoveSheet</bookmark_value> + <bookmark_value>Calc service;RemoveSheet</bookmark_value> </bookmark> <h2 id="hd_id311591699085933" localize="false">RemoveSheet</h2> <paragraph role="paragraph" id="par_id661591699085351">Removes an existing sheet from the document.</paragraph> @@ -1108,7 +1265,7 @@ <section id="RenameSheet"> <comment> RenameSheet -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id781591704316677"> - <bookmark_value>Document service;RenameSheet</bookmark_value> + <bookmark_value>Calc service;RenameSheet</bookmark_value> </bookmark> <h2 id="hd_id171591704316197" localize="false">RenameSheet</h2> <paragraph role="paragraph" id="par_id971591704316873">Renames the given sheet and returns <literal>True</literal> if successful.</paragraph> @@ -1134,7 +1291,7 @@ <section id="SetArray"> <comment> SetArray -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id221592745582441"> - <bookmark_value>Document service;SetArray</bookmark_value> + <bookmark_value>Calc service;SetArray</bookmark_value> </bookmark> <h2 id="hd_id831592745582224" localize="false">SetArray</h2> <paragraph role="paragraph" id="par_id191592745582983">Stores the given value starting from a specified target cell. The updated area expands itself from the target cell or from the top-left corner of the given range to accommodate the size of the input <literal>value</literal> argument. Vectors are always expanded vertically.</paragraph> @@ -1175,7 +1332,7 @@ <section id="SetValue"> <comment> SetValue -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id901592231799526"> - <bookmark_value>Document service;SetValue</bookmark_value> + <bookmark_value>Calc service;SetValue</bookmark_value> </bookmark> <h2 id="hd_id681592231799943" localize="false">SetValue</h2> <paragraph role="paragraph" id="par_id601592231799489">Stores the given value in the specified range. The size of the modified area is equal to the size of the target range.</paragraph> @@ -1222,7 +1379,7 @@ <section id="SetCellStyle"> <comment> SetCellStyle -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id21595767687885"> - <bookmark_value>Document service;SetCellStyle</bookmark_value> + <bookmark_value>Calc service;SetCellStyle</bookmark_value> </bookmark> <h2 id="hd_id201595767687377" localize="false">SetCellStyle</h2> <paragraph role="paragraph" id="par_id521595767687154">Applies the specified cell style to the given target range. The full range is updated and the remainder of the sheet is left untouched. If the cell style does not exist, an error is raised.</paragraph> @@ -1250,7 +1407,7 @@ <section id="SetFormula"> <comment> SetFormula -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id231593880376363"> - <bookmark_value>Document service;SetFormula</bookmark_value> + <bookmark_value>Calc service;SetFormula</bookmark_value> </bookmark> <h2 id="hd_id191593880376344" localize="false">SetFormula</h2> <paragraph role="paragraph" id="par_id481593880376480">Inserts the given (array of) formula(s) in the specified range. The size of the modified area is equal to the size of the range.</paragraph> @@ -1287,7 +1444,7 @@ <section id="SortRange"> <comment> SortRange -------------------------------------------------------------------------------------------------------------------------- </comment> <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id531595692394747"> - <bookmark_value>Document service;SortRange</bookmark_value> + <bookmark_value>Calc service;SortRange</bookmark_value> </bookmark> <h2 id="hd_id71595692394823" localize="false">SortRange</h2> <paragraph role="paragraph" id="par_id141595692394382">Sorts the given range based on up to 3 columns/rows. The sorting order may vary by column/row. It returns a string representing the modified range of cells. The size of the modified area is fully determined by the size of the source area.</paragraph> @@ -1317,6 +1474,7 @@ <embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#SF_InternalUse"/> <section id="relatedtopics"> + <embed href="text/sbasic/shared/03/sf_chart.xhp#ChartService"/> <embed href="text/sbasic/shared/03/sf_document.xhp#DocumentService"/> <embed href="text/sbasic/shared/03/sf_ui.xhp#UIService"/> </section>