001package com.hfg.xml.msoffice2003.spreadsheetml; 002 003import com.hfg.xml.XMLTag; 004 005 006//------------------------------------------------------------------------------ 007/** 008 Excel table column. All Column elements for a spreadsheet must follow the Table 009 element and precede the first Row element. 010 011 @author J. Alex Taylor, hairyfatguy.com 012 */ 013//------------------------------------------------------------------------------ 014// com.hfg Library 015// 016// This library is free software; you can redistribute it and/or 017// modify it under the terms of the GNU Lesser General Public 018// License as published by the Free Software Foundation; either 019// version 2.1 of the License, or (at your option) any later version. 020// 021// This library is distributed in the hope that it will be useful, 022// but WITHOUT ANY WARRANTY; without even the implied warranty of 023// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 024// Lesser General Public License for more details. 025// 026// You should have received a copy of the GNU Lesser General Public 027// License along with this library; if not, write to the Free Software 028// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 029// 030// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 031// jataylor@hairyfatguy.com 032//------------------------------------------------------------------------------ 033 034public class ExcelColumn extends XMLTag 035{ 036 037 //--------------------------------------------------------------------------- 038 public ExcelColumn() 039 { 040 super(SpreadsheetML.COLUMN); 041 } 042 043 044 //--------------------------------------------------------------------------- 045 /** 046 Specifies whether the column should be automatically sized in Excel to display 047 the entire length of numeric and date values (columns are not automatically re-sized for other data types). 048 */ 049 public ExcelColumn setAutoFitWidth(boolean inValue) 050 { 051 setAttribute(SpreadsheetML.AUTO_FIT_WIDTH_ATT, inValue); 052 return this; 053 } 054 055 //--------------------------------------------------------------------------- 056 /** 057 Specifies whether the column should be hidden or not. 058 */ 059 public ExcelColumn setHidden(boolean inValue) 060 { 061 setAttribute(SpreadsheetML.HIDDEN_ATT, inValue); 062 return this; 063 } 064 065 //--------------------------------------------------------------------------- 066 /** 067 If index values are not specified, the columns are assumed to be consecutive. 068 */ 069 public ExcelColumn setIndex(int inValue) 070 { 071 setAttribute(SpreadsheetML.INDEX_ATT, inValue); 072 return this; 073 } 074 075 //--------------------------------------------------------------------------- 076 /** 077 The Span attribute of a Column element the specified number of columns to the right 078 of the Column element with the Span attribute to be formatted exactly like that Column element. 079 */ 080 public ExcelColumn setSpan(int inValue) 081 { 082 setAttribute(SpreadsheetML.SPAN_ATT, inValue); 083 return this; 084 } 085 086 //--------------------------------------------------------------------------- 087 public ExcelColumn setStyleId(String inValue) 088 { 089 setAttribute(SpreadsheetML.STYLE_ID_ATT, inValue); 090 return this; 091 } 092 093 //--------------------------------------------------------------------------- 094 public ExcelColumn setWidth(int inValue) 095 { 096 setAttribute(SpreadsheetML.WIDTH_ATT, inValue + ""); 097 return this; 098 } 099 100}