當文字串長度超過儲存格寬度時,如果文字串有空格,會出現非預期斷行(全形、半形空格都會)
PDF 版本: 24.8
下圖為問題所在,遇到空格會出現非預期斷行。
Pic.png (24.1 KB)
Dim Word As String = ("1. 甲乙丙丁戊己庚辛壬癸 子丑寅卯辰巳午未申酉戌亥 忠孝仁愛信義和平甲乙丙丁戊己庚辛壬癸子丑寅卯辰巳午未申酉戌亥忠孝仁愛信義和平甲乙丙丁戊己庚辛壬癸子丑寅卯辰巳午未申酉戌亥忠孝仁愛信義和平")
Dim pDoc As New Aspose.Pdf.Document()
Dim pPage As Aspose.Pdf.Page = pDoc.Pages.Add()
pPage.SetPageSize(Aspose.Pdf.PageSize.A4.Width, Aspose.Pdf.PageSize.A4.Height)
Dim pTable As New Aspose.Pdf.Table With {
.ColumnWidths = "35% 65%",
.RepeatingRowsCount = 2,
.DefaultCellBorder = New Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1.0F)
}
pPage.Paragraphs.Add(pTable)
Dim pRows As Aspose.Pdf.Rows = pTable.Rows
Dim R1 As Aspose.Pdf.Row = pRows.Add()
Dim R1C1 As Aspose.Pdf.Cell = R1.Cells.Add("SN")
Dim R1C2 As Aspose.Pdf.Cell = R1.Cells.Add("Text")
Dim R2 As Aspose.Pdf.Row = pRows.Add()
R2.IsRowBroken = True
Dim R2C1 As Aspose.Pdf.Cell = R2.Cells.Add("1")
Dim R2C2 As Aspose.Pdf.Cell = R2.Cells.Add()
Dim R2C2_TF As New Aspose.Pdf.Text.TextFragment(Word)
R2C2_TF.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("PMingLiU")
R2C2_TF.TextState.FontSize = 12
Dim pC2Parag As New Aspose.Pdf.Paragraphs From {R2C2_TF}
R2C2.Paragraphs = pC2Parag
pDoc.Save("X:\Coding\PDF_.pdf")