出力PDFと画像の文字列の交差方法を指定
Contents
[
Hide
]
出力PDFと画像の文字列の交差方法を指定
セルにセルの幅より大きいテキストまたは文字列が含まれている場合、次の列の次のセルが null または空の場合、文字列はオーバーフローします。 Excel ファイルを PDF/Image に保存すると、TextCrossType列挙。次の値があります。
- TextCrossType.DEFAULT: MS Excel のような表示で、次のセルに依存します。次のセルが null の場合、文字列が交差するか、切り捨てられます。
- TextCrossType。 CROSS_KEEP: PDF/Image をエクスポートする MS Excel のような文字列を表示します
- TextCrossType.CROSS_OVERRIDE他のセルと交差してすべてのテキストを表示し、交差したセルのテキストを上書きします
- TextCrossType.STRICT_の_細胞: セルの幅内の文字列のみを表示します。
次のサンプル コードは、サンプル Excel ファイルを読み込み、別の TextCrossType を指定して PDF/Image 形式で保存します。サンプルの Excel ファイルと出力ファイルは、次のリンクからダウンロードできます。
サンプルコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source_directory = "Examples/SampleFiles/SourceDirectory/" | |
output_directory = "Examples/SampleFiles/OutputDirectory/" | |
# Load the Sample Workbook | |
workbook = Workbook(source_directory + "sampleCrossType.xlsx") | |
# Initialize PDF save options | |
saveOptions = PdfSaveOptions() | |
# Set text cross type | |
saveOptions.setTextCrossType(TextCrossType.STRICT_IN_CELL) | |
# Save the excel file. | |
workbook.save(output_directory + "outputCrossType.pdf") |