VB Aspose.Pdf 字体变小方格问题处理

宋体是这样写的:SimSun原先以为是:宋体

先定义字体,在PDF中无法设置,这个找了很久,原来是使用:FontRepository.FindFont方式,这个坑了很久,很多都说是setFont,压根找不到这个方法

Dim font As Aspose.Pdf.Text.Font = Aspose.Pdf.Text.FontRepository.FindFont("SimSun") 'Arial SimSun

 以下是案例:

Dim arrTable As Aspose.Pdf.Table = New Aspose.Pdf.Table() '表格边框

arrTable.Border = New Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.5F, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray)) 'Table边框

doc.Pages(1).Paragraphs.Add(arrTable)

Dim arrRow As Aspose.Pdf.Row = arrTable.Rows.Add()

Dim textState As Aspose.Pdf.Text.TextState = New Aspose.Pdf.Text.TextState()

textState.Font = font

arrRow.Cells.Add(item.Name, textState)

这样就可以在PDF中使用宋体了

寻寻觅觅转流年,磕磕碰碰道缘浅。 揽几缕、轻挽起,暮暮朝朝与君语。
原文地址:https://www.cnblogs.com/bingshao/p/13667242.html