01: package com.xoetrope.export.pdf;
02:
03: import com.xoetrope.export.Block;
04: import com.xoetrope.export.RowBlock;
05: import com.xoetrope.export.TableBlock;
06: import java.util.Hashtable;
07:
08: /**
09: *
10: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
11: * the GNU Public License (GPL), please see license.txt for more details. If
12: * you make commercial use of this software you must purchase a commercial
13: * license from Xoetrope.</p>
14: * <p> $Revision: 1.2 $</p>
15: */
16: public class PdfTableBlock extends TableBlock {
17: Hashtable spanCells;
18:
19: public PdfTableBlock() {
20: }
21:
22: public RowBlock addRow() {
23: PdfRowBlockItem rowItem = new PdfRowBlockItem();
24: blocks.add(rowItem);
25: return rowItem;
26: }
27:
28: // public void setWorksheet( WritableSheet worksheet )
29: // {
30: // sheet = worksheet;
31: // spanCells = new Hashtable();
32: // }
33:
34: /*public Block startTableRow()
35: {
36: return null;
37: }
38:
39: public Block endTableRow()
40: {
41: PdfExporter.addRow();
42: PdfExporter.setColumn( 0 );
43: return null;
44: }
45:
46: public Block writeTableCell( String cellContents )
47: {
48: skipSpanCells();
49: setCell( cellContents );
50: PdfExporter.addColumn();
51: return null;
52: }
53:
54: public Block writeTableCell( String cellContents, int colSpan, int rowSpan )
55: {
56: skipSpanCells();
57: setCell( cellContents );
58: if ( rowSpan > 1 ) {
59: for ( int i = 1; i < rowSpan; i++ ) {
60: String key = PdfExporter.getColumn() + "A:" + ( i + PdfExporter.getRow() ) + "A";
61: spanCells.put( key, sheet.getCell( PdfExporter.getColumn(), i + PdfExporter.getRow() ) );
62: }
63: }
64: PdfExporter.addColumn( colSpan );
65: return null;
66: }
67: **/
68:
69: /*
70: private void skipSpanCells()
71: {
72: boolean span = true;
73: while ( span ) {
74: String key = PdfExporter.getColumn() + "A:" + PdfExporter.getRow() + "A";
75: if ( spanCells.get( key ) != null )
76: PdfExporter.addColumn();
77: else
78: span = false;
79: }
80: }
81:
82: private void setCell( String contents )
83: {
84: Label lbl = new Label( PdfExporter.getColumn(), PdfExporter.getRow(), contents );
85: try {
86: sheet.addCell( lbl );
87: } catch ( WriteException ex ) {
88: ex.printStackTrace();
89: }
90: }
91: */
92:
93: }
|