forked from amazingfate/help
New Intersect() method in SF_Calc service
Change-Id: Iaf0d17bfdf9f49d476743e71ba477ef8f581fe85 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/187450 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
This commit is contained in:
committed by
Alain Romedenne
parent
5beb12ef9f
commit
559c4bc46e
@ -8,21 +8,18 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
-->
|
||||
|
||||
<meta>
|
||||
<topic id="sf_calc" indexer="include" status="PUBLISH">
|
||||
<title id="tit" xml-lang="en-US">SFDocuments.Calc service</title>
|
||||
<filename>/text/sbasic/shared/03/sf_calc.xhp</filename>
|
||||
</topic>
|
||||
</meta>
|
||||
|
||||
<body>
|
||||
<section id="SFDocuments-sf_calc">
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id261582733781987">
|
||||
<bookmark_value>Calc service</bookmark_value>
|
||||
</bookmark>
|
||||
</section>
|
||||
|
||||
<section id="abstract">
|
||||
<h1 id="hd_id731582733781114" xml-lang="en-US"><variable id="CalcService"><link href="text/sbasic/shared/03/sf_calc.xhp"><literal>SFDocuments</literal>.<literal>Calc</literal> service</link></variable></h1>
|
||||
<paragraph role="paragraph" id="par_id381589189355849" xml-lang="en-US">The <literal>SFDocuments</literal> shared library provides a number of methods and properties to facilitate the management and handling of %PRODUCTNAME documents.</paragraph>
|
||||
@ -41,12 +38,10 @@
|
||||
</list>
|
||||
</section>
|
||||
<note id="par_id851638217526844">This help page describes methods and properties that are applicable only to Calc documents.</note>
|
||||
|
||||
<h2 id="hd_id581582885621841" xml-lang="en-US">Service invocation</h2>
|
||||
<paragraph role="paragraph" id="par_id141609955500101">Before using the <literal>Calc</literal> service the <literal>ScriptForge</literal> library needs to be loaded or imported:</paragraph>
|
||||
<embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#importLibs"/>
|
||||
|
||||
<paragraph role="paragraph" id="par_id591589191059889" xml-lang="en-US">The <literal>Calc</literal> service is closely related to the <literal>UI</literal> service of the <literal>ScriptForge</literal> library. Below are a few examples of how the <literal>Calc</literal> service can be invoked.</paragraph>
|
||||
<paragraph role="paragraph" id="par_id591589191059889">The <literal>Calc</literal> service is closely related to the <literal>UI</literal> service of the <literal>ScriptForge</literal> library. Below are a few examples of how the <literal>Calc</literal> service can be invoked.</paragraph>
|
||||
<embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
|
||||
<paragraph role="paragraph" id="par_id551621623999947">The code snippet below creates a <literal>Calc</literal> service instance that corresponds to the currently active Calc document.</paragraph>
|
||||
<bascode>
|
||||
@ -98,7 +93,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id811658778703326">myDoc = CreateScriptService("Calc", bas.ThisComponent)</paragraph>
|
||||
</pycode>
|
||||
<tip id="par_id71611090922315">The use of the prefix "<literal>SFDocuments.</literal>" while calling the service is optional.</tip>
|
||||
|
||||
<h2 id="hd_id991591016893982" xml-lang="en-US">Definitions</h2>
|
||||
<paragraph role="paragraph" id="par_id511591016999246" xml-lang="en-US">Many methods require a "<emph>Sheet</emph>" or a "<emph>Range</emph>" as argument. Single cells are considered a special case of a <literal>Range</literal>.</paragraph>
|
||||
<paragraph role="paragraph" id="par_id511591019278671" xml-lang="en-US">Both may be expressed either as a string or as a reference (= object) depending on the situation:</paragraph>
|
||||
@ -125,7 +119,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id61621533637980">docB = ui.OpenDocument(r"C:\Documents\FileB.ods")</paragraph>
|
||||
<paragraph role="pycode" localize="false" id="pyc_id941621533638353">docB.CopyToRange(docA.Range("SheetX.D4:F8"), "D2:F6")</paragraph>
|
||||
</pycode>
|
||||
|
||||
<h3 id="hd_id941591020321580" localize="false" xml-lang="en-US">SheetName</h3>
|
||||
<paragraph role="paragraph" id="par_id341591020333849" xml-lang="en-US">Either the sheet name as a <literal>string</literal> or an <literal>object</literal> produced by the <literal>.Sheet</literal> property.</paragraph>
|
||||
<paragraph role="paragraph" id="par_id651591020343023" xml-lang="en-US">The shortcut "~" (tilde) represents the current sheet.</paragraph>
|
||||
@ -215,7 +208,6 @@
|
||||
</tablecell>
|
||||
</tablerow>
|
||||
</table>
|
||||
|
||||
<h2 id="hd_id351582885195476" xml-lang="en-US">Properties</h2>
|
||||
<paragraph role="paragraph" id="par_id151591018231905" xml-lang="en-US">All the properties generic to any document are implicitly applicable also to Calc documents. For more information, read the <link href="text/sbasic/shared/03/sf_document.xhp">Document service Help page</link>.</paragraph>
|
||||
<paragraph role="paragraph" id="par_id911591018242565" xml-lang="en-US">The properties specifically available for Calc documents are:</paragraph>
|
||||
@ -529,9 +521,7 @@
|
||||
</tablerow>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<tip id="par_id321611613059105">Visit %PRODUCTNAME 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">XCellRange</link>, <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XSheetCellCursor.html">XSheetCellCursor</link> and <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1sheet_1_1XSpreadsheet.html">XSpreadsheet</link> UNO objects.</tip>
|
||||
|
||||
<h2 id="hd_id501582887473754" xml-lang="en-US">Methods</h2>
|
||||
<section id="methods_toc">
|
||||
<table id="tab_id501611613601554">
|
||||
@ -558,7 +548,7 @@
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#CreateChart">CreateChart</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#CreatePivotTable">CreatePivotTable</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#DAvg">DAvg</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#DAvg">DCount</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#DAvg">DCount</link>
|
||||
</paragraph>
|
||||
</tablecell>
|
||||
<tablecell>
|
||||
@ -575,14 +565,15 @@
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#ImportFromDatabase">ImportFromDatabase</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#ImportStylesFromFile">ImportStylesFromFile</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#InsertSheet">InsertSheet</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#Intersect">Intersect</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#MoveRange">MoveRange</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#MoveSheet">MoveSheet</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#Offset">Offset</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#OpenRangeSelector">OpenRangeSelector</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#Offset">Offset</link>
|
||||
</paragraph>
|
||||
</tablecell>
|
||||
<tablecell>
|
||||
<paragraph id="par_id701611613601554" role="tablecontent" localize="false">
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#OpenRangeSelector">OpenRangeSelector</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#PrintOut">PrintOut</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#Printf">Printf</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#RemoveDuplicates">RemoveDuplicates</link><br/>
|
||||
@ -596,13 +587,12 @@
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#ShiftLeft">ShiftLeft</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#ShiftRight">ShiftRight</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#ShiftUp">ShiftUp</link><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#SortRange">SortRange</link><br/><br/><br/>
|
||||
<link href="text/sbasic/shared/03/sf_calc.xhp#SortRange">SortRange</link><br/><br/>
|
||||
</paragraph>
|
||||
</tablecell>
|
||||
</tablerow>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section id="A1Style">
|
||||
<comment> A1Style ----------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id92158919969104">
|
||||
@ -641,7 +631,6 @@
|
||||
</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">
|
||||
@ -672,7 +661,6 @@
|
||||
</pycode>
|
||||
<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">
|
||||
@ -721,7 +709,6 @@
|
||||
<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">
|
||||
@ -771,7 +758,6 @@
|
||||
<paragraph role="pycode" id="pyc_id711670942025635">myDoc.ClearAll("SheetX.A1:J10", "=SUM(SheetX.A1:A10)>100", "COLUMN")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="ClearFormats">
|
||||
<comment> ClearFormats -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id591592919864362">
|
||||
@ -798,7 +784,6 @@
|
||||
</pycode>
|
||||
<tip id="par_id461670942481018">Refer to the <link href="text/sbasic/shared/03/sf_calc.xhp#ClearAll"><literal>ClearAll</literal></link> method documentation for examples on how to use the arguments <literal>filterformula</literal> and <literal>filterscope</literal>.</tip>
|
||||
</section>
|
||||
|
||||
<section id="ClearValues">
|
||||
<comment> ClearValues -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id781592919928644">
|
||||
@ -825,7 +810,6 @@
|
||||
</pycode>
|
||||
<tip id="par_id461670942483664">Refer to the <link href="text/sbasic/shared/03/sf_calc.xhp#ClearAll"><literal>ClearAll</literal></link> method documentation for examples on how to use the arguments <literal>filterformula</literal> and <literal>filterscope</literal>.</tip>
|
||||
</section>
|
||||
|
||||
<section id="CompactLeft">
|
||||
<comment> CompactLeft ------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id781592919922589">
|
||||
@ -866,7 +850,6 @@
|
||||
<paragraph role="pycode" id="pyc_id731652272123209">newrange = myDoc.CompactLeft("Sheet1.G1:L10", filterformula = '=(MOD(SUM(G1:G10);2)=1)')</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="CompactUp">
|
||||
<comment> CompactUp --------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id781592919928589">
|
||||
@ -907,7 +890,6 @@
|
||||
<paragraph role="pycode" id="pyc_id731652272123109">newrange = myDoc.CompactUp("Sheet1.G1:L10", filterformula = '=(MOD(SUM(G1:L1);2)=1)')</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="CopySheet">
|
||||
<comment> CopySheet -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id901591631693213">
|
||||
@ -949,7 +931,6 @@
|
||||
</pycode>
|
||||
<tip id="par_id801595695285478" xml-lang="en-US">To copy sheets between <emph>open</emph> documents, use <literal>CopySheet</literal>. To copy sheets from documents that are <emph>closed</emph>, use <literal>CopySheetFromFile</literal>.</tip>
|
||||
</section>
|
||||
|
||||
<section id="CopySheetFromFile">
|
||||
<comment> CopySheetFromFile -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id101591714614827">
|
||||
@ -978,7 +959,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id171621537641434">myDoc.CopySheetFromFile(r"C:\Documents\myFile.ods", "SheetX", "SheetY", 1)</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="CopyToCell">
|
||||
<comment> CopyToCell -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id481592558768560">
|
||||
@ -1021,7 +1001,6 @@
|
||||
</pycode>
|
||||
<tip id="par_id61592905442071" xml-lang="en-US">To simulate a Copy/Paste from a range to a single cell, use <literal>CopyToCell</literal>. To simulate a Copy/Paste from a range to a larger range (with the same cells being replicated several times), use <literal>CopyToRange</literal>.</tip>
|
||||
</section>
|
||||
|
||||
<section id="CopyToRange">
|
||||
<comment> CopyToRange -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id171592903121677">
|
||||
@ -1069,7 +1048,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id691621538288954">docB.CopyToRange(docA.Range("SheetX.A1:F10"), "SheetY.C5:J5")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="CreateChart">
|
||||
<comment> CreateChart ------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id171592903123257">
|
||||
@ -1101,7 +1079,6 @@
|
||||
</pycode>
|
||||
<tip id="par_id231635441342180">Refer to the help page about ScriptForge's <link href="text/sbasic/shared/03/sf_chart.xhp">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="CreatePivotTable">
|
||||
<comment> CreatePivotTable ---------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id171592903120147">
|
||||
@ -1162,7 +1139,6 @@
|
||||
</pycode>
|
||||
<tip id="par_id231635441342284">To learn more about Pivot Tables in %PRODUCTNAME Calc, read the <link href="text/scalc/guide/datapilot.xhp">Pivot Table</link> help page.</tip>
|
||||
</section>
|
||||
|
||||
<section id="DAvg">
|
||||
<comment> DAvg, DCount, DMax, DMin, DSum -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id791595777001863">
|
||||
@ -1204,7 +1180,6 @@
|
||||
</pycode>
|
||||
<note id="par_id31611752782288">Cells in the given range that contain text will be ignored by all of these functions. For example, the <literal>DCount</literal> method will not count cells with text, only numerical cells.</note>
|
||||
</section>
|
||||
|
||||
<section id="ExportRangeToFile">
|
||||
<comment> ExportRangeToFile --------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id271591632729478">
|
||||
@ -1237,7 +1212,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id961623063234881">doc.ExportRangeToFile("SheetX.A1:D10", r"C:\Temp\image.png", "png", overwrite = True)</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="Forms">
|
||||
<comment> Forms ------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id271591632726788">
|
||||
@ -1279,7 +1253,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id961623063234990">form_A = doc.Forms("Sheet1", "Form_A")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="GetColumnName">
|
||||
<comment> GetColumnName -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id271591632726624">
|
||||
@ -1306,7 +1279,6 @@
|
||||
</pycode>
|
||||
<note id="par_id451611753568778">The maximum number of columns allowed on a Calc sheet is 16384.</note>
|
||||
</section>
|
||||
|
||||
<section id="GetFormula">
|
||||
<comment> GetFormula -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id141593880142749">
|
||||
@ -1332,7 +1304,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id191621540254086">arrFormula = myDoc.GetFormula("~.A1:B3")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="GetValue">
|
||||
<comment> GetValue -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id571592231156848">
|
||||
@ -1357,7 +1328,6 @@
|
||||
</pycode>
|
||||
<note id="par_id991611756492772">If a cell contains a date, the number corresponding to that date will be returned. To convert numeric values to dates in Basic scripts, use the Basic <link href="text/sbasic/shared/03100300.xhp"><literal>CDate</literal> builtin function</link>. In Python scripts, use the <link href="text/sbasic/shared/03/sf_basic.xhp#CDate"><literal>CDate</literal> function from the <literal>Basic</literal> service.</link></note>
|
||||
</section>
|
||||
|
||||
<section id="ImportFromCSVFile">
|
||||
<comment> ImportFromCSVFile -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id381593685490638">
|
||||
@ -1412,7 +1382,6 @@
|
||||
</pycode>
|
||||
<tip id="par_id531611757154931">To learn more about the CSV Filter Options, refer to the <link href="text/shared/guide/csv_params.xhp">CSV Filter Options help page</link>.</tip>
|
||||
</section>
|
||||
|
||||
<section id="ImportFromDatabase">
|
||||
<comment> ImportFromDatabase -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id281599568986735">
|
||||
@ -1442,9 +1411,7 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id701621542319336">myDoc.ImportFromDatabase(r"C:\Temp\myDbFile.odb", , "SheetY.C5", "SELECT * FROM [Employees] ORDER BY [LastName]")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<embed href="text/sbasic/shared/03/sf_writer.xhp#ImportStylesFromFile"/>
|
||||
|
||||
<section id="InsertSheet">
|
||||
<comment> InsertSheet -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id511591698472720">
|
||||
@ -1471,6 +1438,35 @@
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="Intersect">
|
||||
<comment> Intersect -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id511591698472722">
|
||||
<bookmark_value>Calc service;Intersect</bookmark_value>
|
||||
</bookmark>
|
||||
<h2 id="hd_id661591698472898" localize="false">Intersect</h2>
|
||||
<paragraph role="paragraph" id="par_id121591698472935">Returns the string representing the intersection between the two input ranges, or a zero-length string when the intersection is empty.</paragraph>
|
||||
<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
|
||||
<paragraph role="paragraph" localize="false" id="par_id531621619656744">
|
||||
<input>svc.Intersect(range1:str, range2: str): str </input>
|
||||
</paragraph>
|
||||
<embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
|
||||
<paragraph role="paragraph" id="par_id94159169572749"><emph>range1</emph>: The address string of range 1.</paragraph>
|
||||
<paragraph role="paragraph" id="par_id86159169847269"><emph>range2</emph>: The address string of range 2.</paragraph>
|
||||
<embed href="text/sbasic/shared/00000003.xhp#functexample"/>
|
||||
<paragraph role="paragraph" id="par_id241613764759510">The following example intersects two ranges, and returns the common range between both of them:</paragraph>
|
||||
<embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
|
||||
<bascode>
|
||||
<paragraph role="bascode" localize="false" id="bas_id551755867359014">Dim commonrange As String</paragraph>
|
||||
<paragraph role="bascode" localize="false" id="bas_id851221698472747">commonrange = oDoc.Intersect("A1:D8", "C3:F4")</paragraph>
|
||||
<paragraph role="bascode" xml-lang="en-US" id="bas_id531755867365961">Print commonrange ' displays "$Sheet1.$C$3:$D$4"</paragraph>
|
||||
</bascode>
|
||||
<embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
|
||||
<pycode>
|
||||
<paragraph role="pycode" localize="false" id="pyc_id21621615530373">common_range = myDoc.Intersect("A1:D8", "C3:F4")</paragraph>
|
||||
<paragraph role="pycode" xml-lang="en-US" id="pyc_id631755867515226">print(common_range) # outputs '$Sheet1.$C$3:$D$4' to the Python shell</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="MoveRange">
|
||||
<comment> MoveRange -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id381592569476239">
|
||||
@ -1479,7 +1475,6 @@
|
||||
<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>
|
||||
<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
|
||||
|
||||
<paragraph role="paragraph" localize="false" id="par_id211621620062306">
|
||||
<input>svc.MoveRange(source: str, destination: str): str</input>
|
||||
</paragraph>
|
||||
@ -1496,7 +1491,6 @@
|
||||
<paragraph role="pycode" localize="false" id="par_id171621619974289">myDoc.MoveRange("SheetX.A1:F10", "SheetY.C5")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="MoveSheet">
|
||||
<comment> MoveSheet -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id561591698903617">
|
||||
@ -1522,7 +1516,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id561621620208625">myDoc.MoveSheet("SheetX", "SheetY")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="Offset">
|
||||
<comment> Offset ------------------------------------------------------------------------------------------------ </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id29159223350681">
|
||||
@ -1557,7 +1550,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id991621620345183">myDoc.Offset("A1", 2, 2, 5, 6)</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="OpenRangeSelector">
|
||||
<comment> OpenRangeSelector ------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id29159223350681">
|
||||
@ -1587,7 +1579,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id181621620341364">sRange = myDoc.OpenRangeSelector(title = "Select a range")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="Printf">
|
||||
<comment> Printf ------------------------------------------------------------------------------------------------ </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id29159223356581">
|
||||
@ -1660,7 +1651,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id911637944944046">myDoc.SetFormula("F1:F10", myDoc.Printf(sFormula, sRange))</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="PrintOut">
|
||||
<comment> PrintOut ---------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id721985200121249">
|
||||
@ -1690,7 +1680,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id221628227947414"> # ...</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="RemoveDuplicates">
|
||||
<comment> RemoveDuplicates ------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id821596699086119">
|
||||
@ -1727,7 +1716,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id891674511728519">myDoc.RemoveDuplicates("A1:D10", columns = (1, 2), header = True, mode = "CLEAR")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="RemoveSheet">
|
||||
<comment> RemoveSheet -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id821591699085559">
|
||||
@ -1751,7 +1739,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id891621620636884">myDoc.RemoveSheet("SheetY")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="RenameSheet">
|
||||
<comment> RenameSheet -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id781591704316677">
|
||||
@ -1777,7 +1764,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id521621620764138">mydoc.RenameSheet("~", "SheetY")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="SetArray">
|
||||
<comment> SetArray -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id221592745582441">
|
||||
@ -1818,7 +1804,6 @@
|
||||
</pycode>
|
||||
<tip id="par_id291592905671530" xml-lang="en-US">To dump the full contents of an array in a sheet, use <emph>SetArray</emph>. To dump the contents of an array only within the boundaries of the targeted range of cells, use <emph>SetValue</emph>.</tip>
|
||||
</section>
|
||||
|
||||
<section id="SetCellStyle">
|
||||
<comment> SetCellStyle -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id21595767687885">
|
||||
@ -1848,7 +1833,6 @@
|
||||
</pycode>
|
||||
<tip id="par_id461670942481294">Refer to the <link href="text/sbasic/shared/03/sf_calc.xhp#ClearAll"><literal>ClearAll</literal></link> method documentation for examples on how to use the arguments <literal>filterformula</literal> and <literal>filterscope</literal>.</tip>
|
||||
</section>
|
||||
|
||||
<section id="SetFormula">
|
||||
<comment> SetFormula -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id231593880376363">
|
||||
@ -1886,7 +1870,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id651621623174759">myDoc.SetFormula("A1:D2", "=E1")</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="SetValue">
|
||||
<comment> SetValue -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id901592231799526">
|
||||
@ -1933,7 +1916,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id771621689923430">doc.SetValue(newRange, arrData)</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="ShiftDown">
|
||||
<comment> ShiftDown --------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id231593880376104">
|
||||
@ -1976,7 +1958,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id151638218996938">bas.MsgBox(sNewRange)</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="ShiftLeft">
|
||||
<comment> ShiftLeft --------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id231593880376547">
|
||||
@ -2011,7 +1992,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id651621623172116">myDoc.ShiftLeft("A3:D6", WholeColumn = True)</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="ShiftUp">
|
||||
<comment> ShiftUp ----------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id231593880376104">
|
||||
@ -2046,7 +2026,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id651621623174036">myDoc.ShiftUp("A3:D6", wholerow = True)</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="ShiftRight">
|
||||
<comment> ShiftRight --------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id231593880376025">
|
||||
@ -2082,10 +2061,9 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id651621623174751">myDoc.ShiftRight("A3:A6", wholecolumn = True)</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<section id="SortRange">
|
||||
<comment> SortRange -------------------------------------------------------------------------------------------------------------------------- </comment>
|
||||
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id531595692394747">
|
||||
<bookmark localize="false" branch="index" id="bm_id531595692394747">
|
||||
<bookmark_value>Calc service;SortRange</bookmark_value>
|
||||
</bookmark>
|
||||
<h2 id="hd_id71595692394823" localize="false">SortRange</h2>
|
||||
@ -2101,7 +2079,7 @@
|
||||
<paragraph role="paragraph" id="par_id361595692394604"><emph>destinationcell</emph>: The destination cell of the sorted range of cells, as a string. If a range is given, only its top-left cell is considered. By default the source Range is overwritten.</paragraph>
|
||||
<paragraph role="paragraph" id="par_id441595693011034"><emph>containsheader</emph>: When <literal>True</literal>, the first row/column is not sorted.</paragraph>
|
||||
<paragraph role="paragraph" id="par_id241595693169032"><emph>casesensitive</emph>: Only for string comparisons. Default = <literal>False</literal></paragraph>
|
||||
<paragraph role="paragraph" id="par_id1001595693326226"><emph>sortcolumns</emph>: When <literal>True</literal>, the columns are sorted from left to right. Default = <literal>False</literal> : rows are sorted from top to bottom.</paragraph>
|
||||
<paragraph role="paragraph" id="par_id1001595693326226"><emph>sortcolumns</emph>: When <literal>True</literal>, the columns are sorted from left to right. Default = <literal>False</literal>: rows are sorted from top to bottom.</paragraph>
|
||||
<embed href="text/sbasic/shared/00000003.xhp#functexample"/>
|
||||
<embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
|
||||
<bascode>
|
||||
@ -2113,7 +2091,6 @@
|
||||
<paragraph role="pycode" localize="false" id="pyc_id581621623543873">myDoc.SortRange("A2:J200", (1, 3), ("ASC", "DESC"), casesensitive = True)</paragraph>
|
||||
</pycode>
|
||||
</section>
|
||||
|
||||
<embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#SF_InternalUse"/>
|
||||
<section id="relatedtopics">
|
||||
<embed href="text/sbasic/shared/03/sf_chart.xhp#ChartService"/>
|
||||
@ -2121,4 +2098,4 @@
|
||||
<embed href="text/sbasic/shared/03/sf_ui.xhp#UIService"/>
|
||||
</section>
|
||||
</body>
|
||||
</helpdocument>
|
||||
</helpdocument>
|
||||
Reference in New Issue
Block a user