---XSSF ApacheのPOI XSSFCellStyle
public static void main(String[] args)throws Exception
{
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet spreadsheet = workbook.createSheet(
"Text direction");
HSSFRow row = spreadsheet.createRow(2);
HSSFCellStyle myStyle = workbook.createCellStyle();
myStyle.setRotation((short) 0);
HSSFCell cell = row.createCell(1);
cell.setCellValue("0D angle");
cell.setCellStyle(myStyle);
myStyle=workbook.createCellStyle();
myStyle.setRotation((short) 90);
cell = row.createCell(3);
cell.setCellValue("30D angle");
cell.setCellStyle(myStyle);
myStyle=workbook.createCellStyle();
myStyle.setRotation((short) -90);
cell = row.createCell(5);
cell.setCellValue("90D angle");
cell.setCellStyle(myStyle);
FileOutputStream out = new FileOutputStream(
new File("textdirection.xlsx"));
workbook.write(out);
out.close();
System.out.println(
"textdirection.xlsx written successfully");
}
同じコードがWRITEN XSSF出力ファイルの列ヘッダーを使用して回転していません。そのいずれかが、私はこれにヒントを与えることができますXSSF--
public static void main(String[] args)throws Exception
{
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet spreadsheet = workbook.createSheet(
"Text direction");
XSSFRow row = spreadsheet.createRow(2);
XSSFCellStyle myStyle = workbook.createCellStyle();
myStyle.setRotation((short) 0);
XSSFCell cell = row.createCell(1);
cell.setCellValue("0D angle");
cell.setCellStyle(myStyle);
myStyle=workbook.createCellStyle();
myStyle.setRotation((short) 180);
cell = row.createCell(3);
cell.setCellValue("30D angle");
cell.setCellStyle(myStyle);
myStyle=workbook.createCellStyle();
myStyle.setRotation((short) -180);
cell = row.createCell(5);
cell.setCellValue("90D angle");
cell.setCellStyle(myStyle);
FileOutputStream out = new FileOutputStream(
new File("textdirection.xlsx"));
workbook.write(out);
out.close();
System.out.println(
"textdirection.xlsx written successfully");
}
を使用してコードの下 。
ありがとうございました。
@Basavarajは、私の答えが正しいかどうか - そう、最高の一人としてそれをマークしてください他のコミュニティーのメンバーも役に立つと思うかもしれません。 – xSAVIKx