1 19 20 package jxl.write.biff; 21 22 import java.io.IOException ; 23 import java.util.ArrayList ; 24 import java.util.Iterator ; 25 import java.util.HashMap ; 26 27 import common.Assert; 28 import jxl.biff.FormatRecord; 29 import jxl.biff.Fonts; 30 import jxl.biff.XFRecord; 31 import jxl.biff.FormattingRecords; 32 import jxl.biff.NumFormatRecordsException; 33 import jxl.format.CellFormat; 34 import jxl.format.Alignment; 35 import jxl.format.VerticalAlignment; 36 import jxl.write.WritableCellFormat; 37 import jxl.write.WritableWorkbook; 38 import jxl.write.NumberFormats; 39 40 45 public class WritableFormattingRecords extends FormattingRecords 46 { 47 50 public static WritableCellFormat normalStyle; 51 52 59 public WritableFormattingRecords(Fonts f, Styles styles) 60 { 61 super(f); 62 63 try 64 { 65 StyleXFRecord sxf = new StyleXFRecord 67 (styles.getArial10Pt(),NumberFormats.DEFAULT); 68 sxf.setLocked(true); 69 addStyle(sxf); 70 71 sxf = new StyleXFRecord(getFonts().getFont(1),NumberFormats.DEFAULT); 72 sxf.setLocked(true); 73 sxf.setCellOptions(0xf400); 74 addStyle(sxf); 75 76 sxf = new StyleXFRecord(getFonts().getFont(1),NumberFormats.DEFAULT); 77 sxf.setLocked(true); 78 sxf.setCellOptions(0xf400); 79 addStyle(sxf); 80 81 sxf = new StyleXFRecord(getFonts().getFont(1),NumberFormats.DEFAULT); 82 sxf.setLocked(true); 83 sxf.setCellOptions(0xf400); 84 addStyle(sxf); 85 86 sxf = new StyleXFRecord(getFonts().getFont(2),NumberFormats.DEFAULT); 87 sxf.setLocked(true); 88 sxf.setCellOptions(0xf400); 89 addStyle(sxf); 90 91 sxf = new StyleXFRecord(getFonts().getFont(3),NumberFormats.DEFAULT); 92 sxf.setLocked(true); 93 sxf.setCellOptions(0xf400); 94 addStyle(sxf); 95 96 sxf = new StyleXFRecord(styles.getArial10Pt(), 97 NumberFormats.DEFAULT); 98 sxf.setLocked(true); 99 sxf.setCellOptions(0xf400); 100 addStyle(sxf); 101 102 sxf = new StyleXFRecord(styles.getArial10Pt(), 103 NumberFormats.DEFAULT); 104 sxf.setLocked(true); 105 sxf.setCellOptions(0xf400); 106 addStyle(sxf); 107 108 sxf = new StyleXFRecord(styles.getArial10Pt(), 109 NumberFormats.DEFAULT); 110 sxf.setLocked(true); 111 sxf.setCellOptions(0xf400); 112 addStyle(sxf); 113 114 sxf = new StyleXFRecord(styles.getArial10Pt(), 115 NumberFormats.DEFAULT); 116 sxf.setLocked(true); 117 sxf.setCellOptions(0xf400); 118 addStyle(sxf); 119 120 sxf = new StyleXFRecord(styles.getArial10Pt(), 121 NumberFormats.DEFAULT); 122 sxf.setLocked(true); 123 sxf.setCellOptions(0xf400); 124 addStyle(sxf); 125 126 sxf = new StyleXFRecord(styles.getArial10Pt(), 127 NumberFormats.DEFAULT); 128 sxf.setLocked(true); 129 sxf.setCellOptions(0xf400); 130 addStyle(sxf); 131 132 sxf = new StyleXFRecord(styles.getArial10Pt(), 133 NumberFormats.DEFAULT); 134 sxf.setLocked(true); 135 sxf.setCellOptions(0xf400); 136 addStyle(sxf); 137 138 sxf = new StyleXFRecord(styles.getArial10Pt(), 139 NumberFormats.DEFAULT); 140 sxf.setLocked(true); 141 sxf.setCellOptions(0xf400); 142 addStyle(sxf); 143 144 sxf = new StyleXFRecord(styles.getArial10Pt(), 145 NumberFormats.DEFAULT); 146 sxf.setLocked(true); 147 sxf.setCellOptions(0xf400); 148 addStyle(sxf); 149 150 addStyle(styles.getNormalStyle()); 153 154 sxf = new StyleXFRecord(getFonts().getFont(1), 156 NumberFormats.FORMAT7); 157 sxf.setLocked(true); 158 sxf.setCellOptions(0xf800); 159 addStyle(sxf); 160 161 sxf = new StyleXFRecord(getFonts().getFont(1), 162 NumberFormats.FORMAT5); 163 sxf.setLocked(true); 164 sxf.setCellOptions(0xf800); 165 addStyle(sxf); 166 167 sxf = new StyleXFRecord(getFonts().getFont(1), 168 NumberFormats.FORMAT8); 169 sxf.setLocked(true); 170 sxf.setCellOptions(0xf800); 171 addStyle(sxf); 172 173 sxf = new StyleXFRecord(getFonts().getFont(1), 174 NumberFormats.FORMAT6); 175 sxf.setLocked(true); 176 sxf.setCellOptions(0xf800); 177 addStyle(sxf); 178 179 sxf = new StyleXFRecord(getFonts().getFont(1), 180 NumberFormats.PERCENT_INTEGER); 181 sxf.setLocked(true); 182 sxf.setCellOptions(0xf800); 183 addStyle(sxf); 184 185 223 } 224 catch (NumFormatRecordsException e) 225 { 226 Assert.verify(false, e.getMessage()); 229 } 230 } 231 } 232 233 234 235 236 237 238 239 240 241 | Popular Tags |