如何在不打开图纸的情况下设置字体???
<P> Dim objDbx As AxDbDocument </P><P> If Left(Version, 2) = "15" Then<BR> Set objDbx = CreateObject("ObjectDBX.AxDbDocument.1")<BR> ElseIf Left(Version, 2) = "16" Then<BR> Set objDbx = CreateObject("ObjectDBX.AxDbDocument.16")<BR> End If</P>
<P>Opendatabase</P>
<P> '打开数据库,遍历图纸,得到要打开的图纸路径</P>
<P> Dim i As Integer<BR> Dim SheetPath As String '图纸详细路径变量<BR> Dim adoRs As New Recordset<BR> adoRs.Open "SheetList", adoCon, adOpenDynamic, adLockOptimistic<BR> adoRs.MoveFirst<BR> For i = 0 To adoRs.RecordCount - 1<BR> SSheetName = adoRs.Fields("SheetName") '图纸详细路径 <BR> <BR> objDbx.Open SSheetName<BR> <BR> Dim txtStyleObj As AcadTextStyle<BR> <BR> ' 添加文字样式到文字样式集合中<BR> Set txtStyleObj = objDbx.TextStyles.Add("仿宋_GB2312")<BR> txtStyleObj.SetFont "仿宋_GB2312", False, False, 1, 0<BR> ThisDrawing.ActiveTextStyle = txtStyleObj<BR> <BR> objDbx.SaveAs SheetPath<BR> <BR> Next i<BR> adoRs.Close</P>
<P> 以上代码实现了在不打开图纸的情况下,为每张图纸添加了“仿宋_GB2312”,但并没有实现图纸的初始默认字体为“仿宋_GB2312”。 </P>
<P> 我曾尝试objDbx.ActiveTextStyle = txtStyleObj这条语句,但失败了。请问如何才能设置为图纸的当前字体为我所添加的字体??</P> 顶一个
页:
[1]