DBNum カスタム パターン形式の指定

考えられる使用シナリオ

Aspose.Cells はDB番号カスタム パターンの書式設定。たとえば、セルの値が 123 で、そのカスタム フォーマットを [DBNum2][$-804]General として指定すると、壹佰贰拾叁のように表示されます。を使用して、セルのカスタム書式を指定できます[Cell.getStyle()](https://reference.aspose.com/cells/java/com.aspose.cells/cell#getStyle()) とStyle.setCustom()メソッド。

サンプルコード

次のサンプル コードは、指定方法を示しています。DB番号カスタム パターンの書式設定。チェックしてください出力 PDFさらにヘルプが必要です。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(SpecifyingDBNumCustomPatternFormatting.class) + "data/";
//Create a workbook.
Workbook wb = new Workbook();
//Access first worksheet.
Worksheet ws = wb.getWorksheets().get(0);
//Access cell A1 and put value 123.
Cell cell = ws.getCells().get("A1");
cell.putValue(123);
//Access cell style.
Style st = cell.getStyle();
//Specifying DBNum custom pattern formatting.
st.setCustom("[DBNum2][$-804]General");
//Set the cell style.
cell.setStyle(st);
//Set the first column width.
ws.getCells().setColumnWidth(0, 30);
//Save the workbook in output pdf format.
wb.save(dataDir + "outputDBNumCustomFormatting.pdf", SaveFormat.PDF);