You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Sheet.java 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.ss.usermodel;
  16. import java.util.Iterator;
  17. import org.apache.poi.hssf.util.PaneInformation;
  18. import org.apache.poi.ss.util.CellRangeAddress;
  19. /**
  20. * High level representation of a Excel worksheet.
  21. *
  22. * <p>
  23. * Sheets are the central structures within a workbook, and are where a user does most of his spreadsheet work.
  24. * The most common type of sheet is the worksheet, which is represented as a grid of cells. Worksheet cells can
  25. * contain text, numbers, dates, and formulas. Cells can also be formatted.
  26. * </p>
  27. */
  28. public interface Sheet extends Iterable<Row> {
  29. /* Constants for margins */
  30. public static final short LeftMargin = 0;
  31. public static final short RightMargin = 1;
  32. public static final short TopMargin = 2;
  33. public static final short BottomMargin = 3;
  34. public static final short HeaderMargin = 4;
  35. public static final short FooterMargin = 5;
  36. public static final byte PANE_LOWER_RIGHT = (byte) 0;
  37. public static final byte PANE_UPPER_RIGHT = (byte) 1;
  38. public static final byte PANE_LOWER_LEFT = (byte) 2;
  39. public static final byte PANE_UPPER_LEFT = (byte) 3;
  40. /**
  41. * Create a new row within the sheet and return the high level representation
  42. *
  43. * @param rownum row number
  44. * @return high level Row object representing a row in the sheet
  45. * @see #removeRow(Row)
  46. */
  47. Row createRow(int rownum);
  48. /**
  49. * Remove a row from this sheet. All cells contained in the row are removed as well
  50. *
  51. * @param row representing a row to remove.
  52. */
  53. void removeRow(Row row);
  54. /**
  55. * Returns the logical row (not physical) 0-based. If you ask for a row that is not
  56. * defined you get a null. This is to say row 4 represents the fifth row on a sheet.
  57. *
  58. * @param rownum row to get (0-based)
  59. * @return Row representing the rownumber or null if its not defined on the sheet
  60. */
  61. Row getRow(int rownum);
  62. /**
  63. * Returns the number of physically defined rows (NOT the number of rows in the sheet)
  64. *
  65. * @return the number of physically defined rows in this sheet
  66. */
  67. int getPhysicalNumberOfRows();
  68. /**
  69. * Gets the first row on the sheet
  70. *
  71. * @return the number of the first logical row on the sheet (0-based)
  72. */
  73. int getFirstRowNum();
  74. /**
  75. * Gets the last row on the sheet
  76. *
  77. * @return last row contained n this sheet (0-based)
  78. */
  79. int getLastRowNum();
  80. /**
  81. * Get the visibility state for a given column
  82. *
  83. * @param columnIndex - the column to get (0-based)
  84. * @param hidden - the visiblity state of the column
  85. */
  86. void setColumnHidden(int columnIndex, boolean hidden);
  87. /**
  88. * Get the hidden state for a given column
  89. *
  90. * @param columnIndex - the column to set (0-based)
  91. * @return hidden - <code>false</code> if the column is visible
  92. */
  93. boolean isColumnHidden(int columnIndex);
  94. /**
  95. * Set the width (in units of 1/256th of a character width)
  96. * <p>
  97. * The maximum column width for an individual cell is 255 characters.
  98. * This value represents the number of characters that can be displayed
  99. * in a cell that is formatted with the standard font.
  100. * </p>
  101. *
  102. * @param columnIndex - the column to set (0-based)
  103. * @param width - the width in units of 1/256th of a character width
  104. */
  105. void setColumnWidth(int columnIndex, int width);
  106. /**
  107. * get the width (in units of 1/256th of a character width )
  108. * @param columnIndex - the column to set (0-based)
  109. * @return width - the width in units of 1/256th of a character width
  110. */
  111. int getColumnWidth(int columnIndex);
  112. /**
  113. * Set the default column width for the sheet (if the columns do not define their own width)
  114. * in characters
  115. *
  116. * @param width default column width measured in characters
  117. */
  118. void setDefaultColumnWidth(int width);
  119. /**
  120. * Get the default column width for the sheet (if the columns do not define their own width)
  121. * in characters
  122. *
  123. * @return default column width measured in characters
  124. */
  125. int getDefaultColumnWidth();
  126. /**
  127. * Get the default row height for the sheet (if the rows do not define their own height) in
  128. * twips (1/20 of a point)
  129. *
  130. * @return default row height measured in twips (1/20 of a point)
  131. */
  132. short getDefaultRowHeight();
  133. /**
  134. * Get the default row height for the sheet (if the rows do not define their own height) in
  135. * points.
  136. *
  137. * @return default row height in points
  138. */
  139. float getDefaultRowHeightInPoints();
  140. /**
  141. * Set the default row height for the sheet (if the rows do not define their own height) in
  142. * twips (1/20 of a point)
  143. *
  144. * @param height default row height measured in twips (1/20 of a point)
  145. */
  146. void setDefaultRowHeight(short height);
  147. /**
  148. * Set the default row height for the sheet (if the rows do not define their own height) in
  149. * points
  150. * @param height default row height
  151. */
  152. void setDefaultRowHeightInPoints(float height);
  153. /**
  154. * Returns the CellStyle that applies to the given
  155. * (0 based) column, or null if no style has been
  156. * set for that column
  157. */
  158. public CellStyle getColumnStyle(int column);
  159. /**
  160. * Sets the CellStyle that applies to the given
  161. * (0 based) column.
  162. */
  163. // public CellStyle setColumnStyle(int column, CellStyle style);
  164. /**
  165. * Adds a merged region of cells (hence those cells form one)
  166. *
  167. * @param region (rowfrom/colfrom-rowto/colto) to merge
  168. * @return index of this region
  169. */
  170. int addMergedRegion(CellRangeAddress region);
  171. /**
  172. * Determines whether the output is vertically centered on the page.
  173. *
  174. * @param value true to vertically center, false otherwise.
  175. */
  176. void setVerticallyCenter(boolean value);
  177. /**
  178. * Determines whether the output is horizontally centered on the page.
  179. *
  180. * @param value true to horizontally center, false otherwise.
  181. */
  182. void setHorizontallyCenter(boolean value);
  183. /**
  184. * Determine whether printed output for this sheet will be horizontally centered.
  185. */
  186. boolean getHorizontallyCenter();
  187. /**
  188. * Determine whether printed output for this sheet will be vertically centered.
  189. */
  190. boolean getVerticallyCenter();
  191. /**
  192. * Removes a merged region of cells (hence letting them free)
  193. *
  194. * @param index of the region to unmerge
  195. */
  196. void removeMergedRegion(int index);
  197. /**
  198. * Returns the number of merged regions
  199. *
  200. * @return number of merged regions
  201. */
  202. int getNumMergedRegions();
  203. /**
  204. * Returns the merged region at the specified index
  205. *
  206. * @return the merged region at the specified index
  207. */
  208. public CellRangeAddress getMergedRegion(int index);
  209. /**
  210. * Returns an iterator of the physical rows
  211. *
  212. * @return an iterator of the PHYSICAL rows. Meaning the 3rd element may not
  213. * be the third row if say for instance the second row is undefined.
  214. */
  215. Iterator<Row> rowIterator();
  216. /**
  217. * Flag indicating whether the sheet displays Automatic Page Breaks.
  218. *
  219. * @param value <code>true</code> if the sheet displays Automatic Page Breaks.
  220. */
  221. void setAutobreaks(boolean value);
  222. /**
  223. * Set whether to display the guts or not
  224. *
  225. * @param value - guts or no guts
  226. */
  227. void setDisplayGuts(boolean value);
  228. /**
  229. * Set whether the window should show 0 (zero) in cells containing zero value.
  230. * When false, cells with zero value appear blank instead of showing the number zero.
  231. *
  232. * @param value whether to display or hide all zero values on the worksheet
  233. */
  234. void setDisplayZeros(boolean value);
  235. /**
  236. * Gets the flag indicating whether the window should show 0 (zero) in cells containing zero value.
  237. * When false, cells with zero value appear blank instead of showing the number zero.
  238. *
  239. * @return whether all zero values on the worksheet are displayed
  240. */
  241. boolean isDisplayZeros();
  242. /**
  243. * Flag indicating whether the Fit to Page print option is enabled.
  244. *
  245. * @param value <code>true</code> if the Fit to Page print option is enabled.
  246. */
  247. void setFitToPage(boolean value);
  248. /**
  249. * Flag indicating whether summary rows appear below detail in an outline, when applying an outline.
  250. *
  251. * <p>
  252. * When true a summary row is inserted below the detailed data being summarized and a
  253. * new outline level is established on that row.
  254. * </p>
  255. * <p>
  256. * When false a summary row is inserted above the detailed data being summarized and a new outline level
  257. * is established on that row.
  258. * </p>
  259. * @param value <code>true</code> if row summaries appear below detail in the outline
  260. */
  261. void setRowSumsBelow(boolean value);
  262. /**
  263. * Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.
  264. *
  265. * <p>
  266. * When true a summary column is inserted to the right of the detailed data being summarized
  267. * and a new outline level is established on that column.
  268. * </p>
  269. * <p>
  270. * When false a summary column is inserted to the left of the detailed data being
  271. * summarized and a new outline level is established on that column.
  272. * </p>
  273. * @param value <code>true</code> if col summaries appear right of the detail in the outline
  274. */
  275. void setRowSumsRight(boolean value);
  276. /**
  277. * Flag indicating whether the sheet displays Automatic Page Breaks.
  278. *
  279. * @return <code>true</code> if the sheet displays Automatic Page Breaks.
  280. */
  281. boolean getAutobreaks();
  282. /**
  283. * Get whether to display the guts or not,
  284. * default value is true
  285. *
  286. * @return boolean - guts or no guts
  287. */
  288. boolean getDisplayGuts();
  289. /**
  290. * Flag indicating whether the Fit to Page print option is enabled.
  291. *
  292. * @return <code>true</code> if the Fit to Page print option is enabled.
  293. */
  294. boolean getFitToPage();
  295. /**
  296. * Flag indicating whether summary rows appear below detail in an outline, when applying an outline.
  297. *
  298. * <p>
  299. * When true a summary row is inserted below the detailed data being summarized and a
  300. * new outline level is established on that row.
  301. * </p>
  302. * <p>
  303. * When false a summary row is inserted above the detailed data being summarized and a new outline level
  304. * is established on that row.
  305. * </p>
  306. * @return <code>true</code> if row summaries appear below detail in the outline
  307. */
  308. boolean getRowSumsBelow();
  309. /**
  310. * Flag indicating whether summary columns appear to the right of detail in an outline, when applying an outline.
  311. *
  312. * <p>
  313. * When true a summary column is inserted to the right of the detailed data being summarized
  314. * and a new outline level is established on that column.
  315. * </p>
  316. * <p>
  317. * When false a summary column is inserted to the left of the detailed data being
  318. * summarized and a new outline level is established on that column.
  319. * </p>
  320. * @return <code>true</code> if col summaries appear right of the detail in the outline
  321. */
  322. boolean getRowSumsRight();
  323. /**
  324. * Gets the flag indicating whether this sheet displays the lines
  325. * between rows and columns to make editing and reading easier.
  326. *
  327. * @return <code>true</code> if this sheet displays gridlines.
  328. * @see #isPrintGridlines() to check if printing of gridlines is turned on or off
  329. */
  330. boolean isPrintGridlines();
  331. /**
  332. * Sets the flag indicating whether this sheet should display the lines
  333. * between rows and columns to make editing and reading easier.
  334. * To turn printing of gridlines use {@link #setPrintGridlines(boolean)}
  335. *
  336. *
  337. * @param show <code>true</code> if this sheet should display gridlines.
  338. * @see #setPrintGridlines(boolean)
  339. */
  340. void setPrintGridlines(boolean show);
  341. /**
  342. * Gets the print setup object.
  343. *
  344. * @return The user model for the print setup object.
  345. */
  346. PrintSetup getPrintSetup();
  347. /**
  348. * Gets the user model for the default document header.
  349. * <p/>
  350. * Note that XSSF offers more kinds of document headers than HSSF does
  351. * </p>
  352. * @return the document header. Never <code>null</code>
  353. */
  354. Header getHeader();
  355. /**
  356. * Gets the user model for the default document footer.
  357. * <p/>
  358. * Note that XSSF offers more kinds of document footers than HSSF does.
  359. *
  360. * @return the document footer. Never <code>null</code>
  361. */
  362. Footer getFooter();
  363. /**
  364. * Sets a flag indicating whether this sheet is selected.
  365. *<p>
  366. * Note: multiple sheets can be selected, but only one sheet can be active at one time.
  367. *</p>
  368. * @param value <code>true</code> if this sheet is selected
  369. * @see Workbook#setActiveSheet(int)
  370. */
  371. void setSelected(boolean value);
  372. /**
  373. * Gets the size of the margin in inches.
  374. *
  375. * @param margin which margin to get
  376. * @return the size of the margin
  377. */
  378. double getMargin(short margin);
  379. /**
  380. * Sets the size of the margin in inches.
  381. *
  382. * @param margin which margin to get
  383. * @param size the size of the margin
  384. */
  385. void setMargin(short margin, double size);
  386. /**
  387. * Answer whether protection is enabled or disabled
  388. *
  389. * @return true => protection enabled; false => protection disabled
  390. */
  391. boolean getProtect();
  392. /**
  393. * Answer whether scenario protection is enabled or disabled
  394. *
  395. * @return true => protection enabled; false => protection disabled
  396. */
  397. boolean getScenarioProtect();
  398. /**
  399. * Sets the zoom magnication for the sheet. The zoom is expressed as a
  400. * fraction. For example to express a zoom of 75% use 3 for the numerator
  401. * and 4 for the denominator.
  402. *
  403. * @param numerator The numerator for the zoom magnification.
  404. * @param denominator The denominator for the zoom magnification.
  405. */
  406. void setZoom(int numerator, int denominator);
  407. /**
  408. * The top row in the visible view when the sheet is
  409. * first viewed after opening it in a viewer
  410. *
  411. * @return short indicating the rownum (0 based) of the top row
  412. */
  413. short getTopRow();
  414. /**
  415. * The left col in the visible view when the sheet is
  416. * first viewed after opening it in a viewer
  417. *
  418. * @return short indicating the rownum (0 based) of the top row
  419. */
  420. short getLeftCol();
  421. /**
  422. * Sets desktop window pane display area, when the
  423. * file is first opened in a viewer.
  424. *
  425. * @param toprow the top row to show in desktop window pane
  426. * @param leftcol the left column to show in desktop window pane
  427. */
  428. void showInPane(short toprow, short leftcol);
  429. /**
  430. * Shifts rows between startRow and endRow n number of rows.
  431. * If you use a negative number, it will shift rows up.
  432. * Code ensures that rows don't wrap around.
  433. *
  434. * Calls shiftRows(startRow, endRow, n, false, false);
  435. *
  436. * <p>
  437. * Additionally shifts merged regions that are completely defined in these
  438. * rows (ie. merged 2 cells on a row to be shifted).
  439. * @param startRow the row to start shifting
  440. * @param endRow the row to end shifting
  441. * @param n the number of rows to shift
  442. */
  443. void shiftRows(int startRow, int endRow, int n);
  444. /**
  445. * Shifts rows between startRow and endRow n number of rows.
  446. * If you use a negative number, it will shift rows up.
  447. * Code ensures that rows don't wrap around
  448. *
  449. * <p>
  450. * Additionally shifts merged regions that are completely defined in these
  451. * rows (ie. merged 2 cells on a row to be shifted).
  452. * <p>
  453. * @param startRow the row to start shifting
  454. * @param endRow the row to end shifting
  455. * @param n the number of rows to shift
  456. * @param copyRowHeight whether to copy the row height during the shift
  457. * @param resetOriginalRowHeight whether to set the original row's height to the default
  458. */
  459. void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight);
  460. /**
  461. * Creates a split (freezepane). Any existing freezepane or split pane is overwritten.
  462. * @param colSplit Horizonatal position of split.
  463. * @param rowSplit Vertical position of split.
  464. * @param topRow Top row visible in bottom pane
  465. * @param leftmostColumn Left column visible in right pane.
  466. */
  467. void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow);
  468. /**
  469. * Creates a split (freezepane). Any existing freezepane or split pane is overwritten.
  470. * @param colSplit Horizonatal position of split.
  471. * @param rowSplit Vertical position of split.
  472. */
  473. void createFreezePane(int colSplit, int rowSplit);
  474. /**
  475. * Creates a split pane. Any existing freezepane or split pane is overwritten.
  476. * @param xSplitPos Horizonatal position of split (in 1/20th of a point).
  477. * @param ySplitPos Vertical position of split (in 1/20th of a point).
  478. * @param topRow Top row visible in bottom pane
  479. * @param leftmostColumn Left column visible in right pane.
  480. * @param activePane Active pane. One of: PANE_LOWER_RIGHT,
  481. * PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFT
  482. * @see #PANE_LOWER_LEFT
  483. * @see #PANE_LOWER_RIGHT
  484. * @see #PANE_UPPER_LEFT
  485. * @see #PANE_UPPER_RIGHT
  486. */
  487. void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane);
  488. /**
  489. * Returns the information regarding the currently configured pane (split or freeze)
  490. *
  491. * @return null if no pane configured, or the pane information.
  492. */
  493. PaneInformation getPaneInformation();
  494. /**
  495. * Sets whether the gridlines are shown in a viewer
  496. *
  497. * @param show whether to show gridlines or not
  498. */
  499. void setDisplayGridlines(boolean show);
  500. /**
  501. * Returns if gridlines are displayed
  502. *
  503. * @return whether gridlines are displayed
  504. */
  505. boolean isDisplayGridlines();
  506. /**
  507. * Sets whether the formulas are shown in a viewer
  508. *
  509. * @param show whether to show formulas or not
  510. */
  511. void setDisplayFormulas(boolean show);
  512. /**
  513. * Returns if formulas are displayed
  514. *
  515. * @return whether formulas are displayed
  516. */
  517. boolean isDisplayFormulas();
  518. /**
  519. * Sets whether the RowColHeadings are shown in a viewer
  520. *
  521. * @param show whether to show RowColHeadings or not
  522. */
  523. void setDisplayRowColHeadings(boolean show);
  524. /**
  525. * Returns if RowColHeadings are displayed.
  526. * @return whether RowColHeadings are displayed
  527. */
  528. boolean isDisplayRowColHeadings();
  529. /**
  530. * Sets a page break at the indicated row
  531. * @param row FIXME: Document this!
  532. */
  533. void setRowBreak(int row);
  534. /**
  535. * Determines if there is a page break at the indicated row
  536. * @param row FIXME: Document this!
  537. * @return FIXME: Document this!
  538. */
  539. boolean isRowBroken(int row);
  540. /**
  541. * Removes the page break at the indicated row
  542. * @param row
  543. */
  544. void removeRowBreak(int row);
  545. /**
  546. * Retrieves all the horizontal page breaks
  547. * @return all the horizontal page breaks, or null if there are no row page breaks
  548. */
  549. int[] getRowBreaks();
  550. /**
  551. * Retrieves all the vertical page breaks
  552. * @return all the vertical page breaks, or null if there are no column page breaks
  553. */
  554. int[] getColumnBreaks();
  555. /**
  556. * Sets a page break at the indicated column
  557. * @param column
  558. */
  559. void setColumnBreak(int column);
  560. /**
  561. * Determines if there is a page break at the indicated column
  562. * @param column FIXME: Document this!
  563. * @return FIXME: Document this!
  564. */
  565. boolean isColumnBroken(int column);
  566. /**
  567. * Removes a page break at the indicated column
  568. * @param column
  569. */
  570. void removeColumnBreak(int column);
  571. /**
  572. * Expands or collapses a column group.
  573. *
  574. * @param columnNumber One of the columns in the group.
  575. * @param collapsed true = collapse group, false = expand group.
  576. */
  577. void setColumnGroupCollapsed(int columnNumber, boolean collapsed);
  578. /**
  579. * Create an outline for the provided column range.
  580. *
  581. * @param fromColumn beginning of the column range.
  582. * @param toColumn end of the column range.
  583. */
  584. void groupColumn(int fromColumn, int toColumn);
  585. /**
  586. * Ungroup a range of columns that were previously groupped
  587. *
  588. * @param fromColumn start column (0-based)
  589. * @param toColumn end column (0-based)
  590. */
  591. void ungroupColumn(int fromColumn, int toColumn);
  592. /**
  593. * Tie a range of rows together so that they can be collapsed or expanded
  594. *
  595. * @param fromRow start row (0-based)
  596. * @param toRow end row (0-based)
  597. */
  598. void groupRow(int fromRow, int toRow);
  599. /**
  600. * Ungroup a range of rows that were previously groupped
  601. *
  602. * @param fromRow start row (0-based)
  603. * @param toRow end row (0-based)
  604. */
  605. void ungroupRow(int fromRow, int toRow);
  606. /**
  607. * Set view state of a groupped range of rows
  608. *
  609. * @param row start row of a groupped range of rows (0-based)
  610. * @param collapse whether to expand/collapse the detail rows
  611. */
  612. void setRowGroupCollapsed(int row, boolean collapse);
  613. /**
  614. * Sets the default column style for a given column. POI will only apply this style to new cells added to the sheet.
  615. *
  616. * @param column the column index
  617. * @param style the style to set
  618. */
  619. void setDefaultColumnStyle(int column, CellStyle style);
  620. /**
  621. * Adjusts the column width to fit the contents.
  622. *
  623. * <p>
  624. * This process can be relatively slow on large sheets, so this should
  625. * normally only be called once per column, at the end of your
  626. * processing.
  627. * </p>
  628. * You can specify whether the content of merged cells should be considered or ignored.
  629. * Default is to ignore merged cells.
  630. *
  631. * @param column the column index
  632. */
  633. void autoSizeColumn(int column);
  634. /**
  635. * Adjusts the column width to fit the contents.
  636. * <p>
  637. * This process can be relatively slow on large sheets, so this should
  638. * normally only be called once per column, at the end of your
  639. * processing.
  640. * </p>
  641. * You can specify whether the content of merged cells should be considered or ignored.
  642. * Default is to ignore merged cells.
  643. *
  644. * @param column the column index
  645. * @param useMergedCells whether to use the contents of merged cells when calculating the width of the column
  646. */
  647. void autoSizeColumn(int column, boolean useMergedCells);
  648. /**
  649. * Returns cell comment for the specified row and column
  650. *
  651. * @return cell comment or <code>null</code> if not found
  652. */
  653. Comment getCellComment(int row, int column);
  654. /**
  655. * Creates the top-level drawing patriarch.
  656. *
  657. * @return The new drawing patriarch.
  658. */
  659. Drawing createDrawingPatriarch();
  660. /**
  661. * Return the parent workbook
  662. *
  663. * @return the parent workbook
  664. */
  665. Workbook getWorkbook();
  666. /**
  667. * Returns the name of this sheet
  668. *
  669. * @return the name of this sheet
  670. */
  671. String getSheetName();
  672. /**
  673. * Note - this is not the same as whether the sheet is focused (isActive)
  674. * @return <code>true</code> if this sheet is currently selected
  675. */
  676. boolean isSelected();
  677. /**
  678. * Sets array formula to specified region for result.
  679. *
  680. * @param formula text representation of the formula
  681. * @param range Region of array formula for result.
  682. * @return the {@link CellRange} of cells affected by this change
  683. */
  684. CellRange<? extends Cell> setArrayFormula(String formula, CellRangeAddress range);
  685. /**
  686. * Remove a Array Formula from this sheet. All cells contained in the Array Formula range are removed as well
  687. *
  688. * @param cell any cell within Array Formula range
  689. * @return the {@link CellRange} of cells affected by this change
  690. */
  691. CellRange<? extends Cell> removeArrayFormula(Cell cell);
  692. public DataValidationHelper getDataValidationHelper();
  693. /**
  694. * Creates a data validation object
  695. * @param dataValidation The Data validation object settings
  696. */
  697. public void addValidationData(DataValidation dataValidation);
  698. }