KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > Sheet


1 /*********************************************************************
2 *
3 * Copyright (C) 2002 Andrew Khan
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ***************************************************************************/

19
20 package jxl;
21
22 import jxl.format.CellFormat;
23
24 /**
25  * Represents a sheet within a workbook. Provides a handle to the individual
26  * cells, or lines of cells (grouped by Row or Column)
27  */

28 public interface Sheet
29 {
30   /**
31    * Returns the cell specified at this row and at this column.
32    * If a column/row combination forms part of a merged group of cells
33    * then (unless it is the first cell of the group) a blank cell
34    * will be returned
35    *
36    * @param column the column number
37    * @param row the row number
38    * @return the cell at the specified co-ordinates
39    */

40   public Cell getCell(int column, int row);
41
42   /**
43    * Returns the number of rows in this sheet
44    *
45    * @return the number of rows in this sheet
46    */

47   public int getRows();
48
49   /**
50    * Returns the number of columns in this sheet
51    *
52    * @return the number of columns in this sheet
53    */

54   public int getColumns();
55
56   /**
57    * Gets all the cells on the specified row
58    *
59    * @param row the rows whose cells are to be returned
60    * @return the cells on the given row
61    */

62   public Cell[] getRow(int row);
63
64   /**
65    * Gets all the cells on the specified column
66    *
67    * @param col the column whose cells are to be returned
68    * @return the cells on the specified column
69    */

70   public Cell[] getColumn(int col);
71
72   /**
73    * Gets the name of this sheet
74    *
75    * @return the name of the sheet
76    */

77   public String JavaDoc getName();
78
79   /**
80    * Determines whether the sheet is hidden
81    *
82    * @return whether or not the sheet is hidden
83    * @deprecated in favouf of the getSettings() method
84    */

85   public boolean isHidden();
86
87   /**
88    * Determines whether the sheet is protected
89    *
90    * @return whether or not the sheet is protected
91    * @deprecated in favour of the getSettings() method
92    */

93   public boolean isProtected();
94
95   /**
96    * Gets the cell whose contents match the string passed in.
97    * If no match is found, then null is returned. The search is performed
98    * on a row by row basis, so the lower the row number, the more
99    * efficiently the algorithm will perform
100    *
101    * @param contents the string to match
102    * @return the Cell whose contents match the paramter, null if not found
103    */

104   public Cell findCell(String JavaDoc contents);
105
106   /**
107    * Gets the cell whose contents match the string passed in.
108    * If no match is found, then null is returned. The search is performed
109    * on a row by row basis, so the lower the row number, the more
110    * efficiently the algorithm will perform. This method differs
111    * from the findCell method in that only cells with labels are
112    * queried - all numerical cells are ignored. This should therefore
113    * improve performance.
114    *
115    * @param contents the string to match
116    * @return the Cell whose contents match the paramter, null if not found
117    */

118   public LabelCell findLabelCell(String JavaDoc contents);
119
120   /**
121    * Gets the hyperlinks on this sheet
122    *
123    * @return an array of hyperlinks
124    */

125   public Hyperlink[] getHyperlinks();
126
127   /**
128    * Gets the cells which have been merged on this sheet
129    *
130    * @return an array of range objects
131    */

132   public Range[] getMergedCells();
133
134   /**
135    * Gets the settings used on a particular sheet
136    *
137    * @return the sheet settings
138    */

139   public SheetSettings getSettings();
140
141   /**
142    * Gets the column format for the specified column
143    *
144    * @param col the column number
145    * @return the column format, or NULL if the column has no specific format
146    * @deprecated Use getColumnView and the CellView bean instead
147    */

148   public CellFormat getColumnFormat(int col);
149
150   /**
151    * Gets the column width for the specified column
152    *
153    * @param col the column number
154    * @return the column width, or the default width if the column has no
155    * specified format
156    * @deprecated Use getColumnView instead
157    */

158   public int getColumnWidth(int col);
159
160   /**
161    * Gets the column width for the specified column
162    *
163    * @param col the column number
164    * @return the column format, or the default format if no override is
165              specified
166    */

167   public CellView getColumnView(int col);
168
169   /**
170    * Gets the column width for the specified column
171    *
172    * @param row the column number
173    * @return the row height, or the default height if the column has no
174    * specified format
175    * @deprecated use getRowView instead
176    */

177   public int getRowHeight(int row);
178
179   /**
180    * Gets the column width for the specified column
181    *
182    * @param row the column number
183    * @return the row format, which may be the default format if no format
184    * is specified
185    */

186   public CellView getRowView(int row);
187
188   /**
189    * Accessor for the number of images on the sheet
190    *
191    * @return the number of images on this sheet
192    */

193   public int getNumberOfImages();
194
195   /**
196    * Accessor for the image
197    *
198    * @param i the 0 based image number
199    * @return the image at the specified position
200    */

201   public Image getDrawing(int i);
202 }
203
204
205
206
207
208
209
210
Popular Tags