d7528dcbf8ef2ac66c9706ac7fdee52fabdbc984.svn-base 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. package UIB.UIB03.ZBS;
  2. import jxl.format.Alignment;
  3. import jxl.format.Border;
  4. import jxl.format.BorderLineStyle;
  5. import jxl.format.Colour;
  6. import jxl.format.VerticalAlignment;
  7. import jxl.write.WritableCellFormat;
  8. import jxl.write.WritableFont;
  9. /**
  10. *
  11. * @desc EXCEL风格设置
  12. * @author meiguiping
  13. * @date 2010 5:52:50 PM
  14. */
  15. public class ExcelStyleSeter
  16. {
  17. /**
  18. * 普通风格设置
  19. */
  20. public static WritableCellFormat getCommStyle() throws Exception
  21. {
  22. WritableFont wf = new WritableFont(WritableFont.createFont("宋体") , 8);//设置字体大小
  23. // wf.setColour(Colour.RED);//设置颜色
  24. WritableCellFormat wcf = new WritableCellFormat(wf);
  25. wcf.setBorder(Border.ALL, BorderLineStyle.THIN);//设置边框
  26. wcf.setAlignment(Alignment.CENTRE);
  27. wcf.setVerticalAlignment(VerticalAlignment.CENTRE);
  28. // wcf.setWrap(true);//自动换行
  29. return wcf;
  30. }
  31. /**
  32. * 表头风格设置
  33. */
  34. public static WritableCellFormat getHeaderStyle() throws Exception
  35. {
  36. // WritableFont wf = new WritableFont(WritableFont.TIMES , 9);//设置字体大小
  37. WritableFont wf = new WritableFont(WritableFont.createFont("宋体") , 9);//设置字体大小
  38. // wf.setColour(Colour.RED);//设置颜色
  39. WritableCellFormat wcf = new WritableCellFormat(wf);
  40. wcf.setBorder(Border.ALL, BorderLineStyle.THIN);//设置边框
  41. // wcf.setWrap(true);//自动换行
  42. return wcf;
  43. }
  44. /**
  45. * @desc 成分名称
  46. * @return
  47. * @throws Exception
  48. */
  49. public static WritableCellFormat getChemNametyle() throws Exception
  50. {
  51. WritableFont wf = new WritableFont(WritableFont.createFont("宋体") , 8);//设置字体大小
  52. // wf.setColour(Colour.BLUE);//设置颜色
  53. WritableCellFormat wcf = new WritableCellFormat(wf);
  54. wcf.setBorder(Border.ALL, BorderLineStyle.THIN);//设置边框
  55. wcf.setShrinkToFit(true);//缩小字体填充
  56. wcf.setAlignment(Alignment.CENTRE);
  57. wcf.setVerticalAlignment(VerticalAlignment.CENTRE);
  58. // wcf.setWrap(true);//自动换行
  59. return wcf;
  60. }
  61. /**
  62. * @desc 成分值风格
  63. * @return
  64. * @throws Exception
  65. */
  66. public static WritableCellFormat getChemValuetyle() throws Exception
  67. {
  68. WritableFont wf = new WritableFont(WritableFont.createFont("宋体") , 7);//设置字体大小
  69. // wf.setColour(Colour.BLUE);//设置颜色
  70. WritableCellFormat wcf = new WritableCellFormat(wf);
  71. wcf.setBorder(Border.ALL, BorderLineStyle.THIN);//设置边框
  72. wcf.setAlignment(Alignment.CENTRE);
  73. wcf.setVerticalAlignment(VerticalAlignment.CENTRE);
  74. // wcf.setWrap(true);//自动换行
  75. return wcf;
  76. }
  77. /**
  78. * @desc 材质值风格
  79. * @return
  80. * @throws Exception
  81. */
  82. public static WritableCellFormat getQltyValueStyle() throws Exception
  83. {
  84. WritableFont wf = new WritableFont(WritableFont.createFont("宋体") , 7);//设置字体大小
  85. // wf.setColour(Colour.BLUE);//设置颜色
  86. WritableCellFormat wcf = new WritableCellFormat(wf);
  87. wcf.setBorder(Border.ALL, BorderLineStyle.THIN);//设置边框
  88. wcf.setAlignment(Alignment.CENTRE);
  89. wcf.setVerticalAlignment(VerticalAlignment.CENTRE);
  90. // wcf.setWrap(true);//自动换行
  91. return wcf;
  92. }
  93. /**
  94. * @desc 材质项目名称风格设置
  95. * @return
  96. * @throws Exception
  97. */
  98. public static WritableCellFormat getQltyNameStyle() throws Exception
  99. {
  100. WritableFont wf = new WritableFont(WritableFont.createFont("黑体") ,7);//设置字体大小及样式
  101. // wf.setColour(Colour.BLUE);//设置颜色
  102. WritableCellFormat wcf = new WritableCellFormat(wf);
  103. wcf.setBorder(Border.ALL, BorderLineStyle.THIN);//设置边框
  104. wcf.setAlignment(Alignment.CENTRE);
  105. wcf.setVerticalAlignment(VerticalAlignment.CENTRE);
  106. wcf.setWrap(true);//自动换行
  107. return wcf;
  108. }
  109. }