<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.harlamenkov.ru/index.php?action=history&amp;feed=atom&amp;title=EN%2Fdocumentation%2Fbasic_guide%2Frows_and_columns</id>
	<title>EN/documentation/basic guide/rows and columns - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.harlamenkov.ru/index.php?action=history&amp;feed=atom&amp;title=EN%2Fdocumentation%2Fbasic_guide%2Frows_and_columns"/>
	<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/rows_and_columns&amp;action=history"/>
	<updated>2026-11-11T14:06:15Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.0</generator>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/rows_and_columns&amp;diff=15957&amp;oldid=prev</id>
		<title>Sancho: Основной текст</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/rows_and_columns&amp;diff=15957&amp;oldid=prev"/>
		<updated>2011-09-02T18:01:53Z</updated>

		<summary type="html">&lt;p&gt;Основной текст&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;section begin=title /&amp;gt;&amp;lt;noinclude&amp;gt;{{DISPLAYTITLE:&amp;lt;/noinclude&amp;gt;Rows and Columns&amp;lt;noinclude&amp;gt;}}&amp;lt;/noinclude&amp;gt;&amp;lt;section end=title /&amp;gt;{{BreadCrumbL10n}}&lt;br /&gt;
&lt;br /&gt;
{{Documentation/BASICGuideTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=EN/documentation/basic_guide/structure_of_spreadsheets&lt;br /&gt;
|NextPage=EN/documentation/basic_guide/cells_and_ranges&lt;br /&gt;
|spread=block&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Each sheet contains a list of its rows and columns. These are available through the &amp;lt;tt&amp;gt;Rows&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Columns&amp;lt;/tt&amp;gt; properties of the spreadsheet object and support the &amp;lt;idl&amp;gt;com.sun.star.table.TableColumns&amp;lt;/idl&amp;gt; and/or &amp;lt;idl&amp;gt;com.sun.star.table.TableRows&amp;lt;/idl&amp;gt; services.&lt;br /&gt;
&lt;br /&gt;
The following example creates two objects that reference the first row and the first column of a sheet and stores the references in the &amp;lt;tt&amp;gt;FirstCol&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;FirstRow&amp;lt;/tt&amp;gt; object variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim FirstRow As Object&lt;br /&gt;
Dim FirstCol As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
FirstCol = Sheet.Columns(0)&lt;br /&gt;
FirstRow = Sheet.Rows(0)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The column objects support the &amp;lt;idl&amp;gt;com.sun.star.table.TableColumn&amp;lt;/idl&amp;gt; service that has the following properties:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Width (long)&amp;lt;/tt&amp;gt;:width of a column in hundredths of a millimeter.&lt;br /&gt;
;&amp;lt;tt&amp;gt;OptimalWidth (Boolean)&amp;lt;/tt&amp;gt;:sets a column to its optimum width.&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsVisible (Boolean)&amp;lt;/tt&amp;gt;:displays a column.&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsStartOfNewPage (Boolean)&amp;lt;/tt&amp;gt;:when printing, creates a page break before a column.&lt;br /&gt;
&lt;br /&gt;
The width of a column is only optimized when the &amp;lt;tt&amp;gt;OptimalWidth&amp;lt;/tt&amp;gt; property is set to &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt;. If the width of an individual cell is changed, the width of the column that contains the cell is not changed. In terms of functionality, &amp;lt;tt&amp;gt;OptimalWidth&amp;lt;/tt&amp;gt; is more of a method than a property.&lt;br /&gt;
&lt;br /&gt;
The row objects are based on the &amp;lt;idl&amp;gt;com.sun.star.table.TableRow&amp;lt;/idl&amp;gt; service that has the following properties: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Height (long)&amp;lt;/tt&amp;gt;:height of the row in 100ths of a millimeter.&lt;br /&gt;
;&amp;lt;tt&amp;gt;OptimalHeight (Boolean)&amp;lt;/tt&amp;gt;:sets the row to its optimum height.&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsVisible (Boolean)&amp;lt;/tt&amp;gt;:displays the row.&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsStartOfNewPage (Boolean)&amp;lt;/tt&amp;gt;:when printing, creates a page break before the row.&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;tt&amp;gt;OptimalHeight&amp;lt;/tt&amp;gt; property of a row is set to the &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt;, the row height changes automatically when the height of a cell in the row is changed. Automatic optimization continues until the row is assigned an absolute height through the &amp;lt;tt&amp;gt;Height&amp;lt;/tt&amp;gt; property.&lt;br /&gt;
&lt;br /&gt;
The following example activates the automatic height optimization for the first five rows in the sheet and makes the second column invisible.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim Row As Object&lt;br /&gt;
Dim Col As Object&lt;br /&gt;
Dim I As Integer&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
For I = 0 To 4&lt;br /&gt;
   Row = Sheet.Rows(I)&lt;br /&gt;
   Row.OptimalHeight = True&lt;br /&gt;
Next I&lt;br /&gt;
&lt;br /&gt;
Col = Sheet.Columns(1)&lt;br /&gt;
Col.IsVisible = False&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|The &amp;lt;tt&amp;gt;Rows&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Columns&amp;lt;/tt&amp;gt; lists can be accessed through an index in {{OOo}} Basic. The real API call is : &amp;lt;tt&amp;gt;Sheet.getColumns.getByIndex(1)&amp;lt;/tt&amp;gt; }}&lt;br /&gt;
&lt;br /&gt;
{{VBAnote|Unlike in VBA, the first column has the index 0 and not the index 1.}}&lt;br /&gt;
&lt;br /&gt;
== Inserting and Deleting Rows and Columns ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Rows&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Columns&amp;lt;/tt&amp;gt; objects of a sheet can access existing rows and columns as well as insert and delete them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim NewColumn As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets(0)&lt;br /&gt;
&lt;br /&gt;
Sheet.Columns.insertByIndex(3, 1)&lt;br /&gt;
Sheet.Columns.removeByIndex(5, 1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example uses the &amp;lt;tt&amp;gt;insertByIndex&amp;lt;/tt&amp;gt; method to insert a new column into the fourth column position in the sheet (index 3 - numbering starts at 0). The second parameter specifies the number of columns to be inserted (in this example: one).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;removeByIndex&amp;lt;/tt&amp;gt; method deletes the sixth column (index 5). Again, the second parameter specifies the number of columns that you want to delete.&lt;br /&gt;
&lt;br /&gt;
The methods for inserting and deleting rows use the &amp;lt;tt&amp;gt;Rows&amp;lt;/tt&amp;gt; object function in the same way as the methods shown for editing columns using the &amp;lt;tt&amp;gt;Columns&amp;lt;/tt&amp;gt; object.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
</feed>