怎样按样式打印?
<P>我在编写一个批量的打印的程序,在程序中样式表已指定,但是下图中"按样式打印"怎么选中?有对应的系统变量吗?不选中的话批量打印时样式表起不了作用.</P><P>(图片截自AutoCAD的打印对话框)</P> 已解决 <P>怎么解决的?分享一下。</P> <P>呵呵,其实一点技术含量都没有,一开始没发现</P>
<P>ThisDrawing.ModelSpace.Layout.PlotWithPlotStyles = True<BR></P> <P>最近,我也编了一个关于批处理的程序,但不知道为什么有时候可以运行,有时候就不可以!程序如下:</P>
<P>Private Sub cmdOk_Click()<BR> Dim i As Integer<BR> Dim ii As Integer<BR> Dim zz As Integer<BR> Dim drn As String<BR> Dim drn1 As String<BR>If lstFile.ListCount = 0 Then<BR>MsgBox "请添加所要操作的图形!"<BR>Exit Sub<BR>End If<BR>frmMain.hide<BR>For i = 0 To lstFile.ListCount - 1<BR>drn1 = lstFile.List(i)<BR>Application.Documents.Open drn1<BR> Dim ptmin(0 To 1) As Double: Dim ptmax(0 To 1) As Double<BR>ptmin(0) = -257: ptmin(1) = -271<BR>ptmax(0) = -1099: ptmax(1) = 324<BR> Dim currentPlot As AcadPlot<BR> Set currentPlot = ThisDrawing.Plot<BR> ThisDrawing.ActiveLayout.SetWindowToPlot ptmin, ptmax<BR> ThisDrawing.ActiveLayout.PlotType = acWindow<BR> If ComboBox1.Text = "ScaleToFit" Then<BR> ThisDrawing.ActiveLayout.StandardScale = acScaleToFit<BR> ThisDrawing.ActiveLayout.StyleSheet = TextBox2.Text<BR> Else<BR> ThisDrawing.ActiveLayout.StandardScale = ac1_1<BR> ThisDrawing.ActiveLayout.StyleSheet = TextBox2.Text<BR> End If<BR> <BR> currentPlot.PlotToDevice TextBox1.Text<BR> Application.ActiveDocument.Close True, drn1<BR>Next i</P>
<P>End Sub</P>
<P>Private Sub cmdOpen_Click()<BR> On Error GoTo errHandle<BR> <BR> Dim i As Integer<BR> Dim Y As Integer<BR> Dim z As Integer<BR> Dim FileNames() As String<BR> <BR> With comDlg<BR> .CancelError = True<BR> .MaxFileSize = 32767<BR> .Flags = cdlOFNHideReadOnly Or cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNNoDereferenceLinks<BR> .DialogTitle = "选择图形文件"<BR> .filter = "图形文件(*.dwg)|*.dwg|所有文件(*.*)|*.*"<BR> .FileName = ""<BR> .ShowOpen<BR> End With<BR> <BR> comDlg.FileName = comDlg.FileName & Chr(0) '这些文件名是用空字符Chr(0)分隔符,而不是空格分隔符隔开<BR> <BR> z = 1<BR> For i = 1 To Len(comDlg.FileName)<BR> 'InStr函数,返回 Variant (Long),指定一字符串在另一字符串中最先出现的位置。<BR> '语法 InStr(起点位置, string1, string2)<BR> i = InStr(z, comDlg.FileName, Chr(0))<BR> If i = 0 Then Exit For<BR> ReDim Preserve FileNames(Y)<BR> 'Mid函数,返回 Variant (String),其中包含字符串中指定数量的字符。<BR> '语法 Mid(string, start[, length])<BR> FileNames(Y) = Mid(comDlg.FileName, z, i - z)<BR> z = i + 1<BR> Y = Y + 1<BR> Next i</P>
<P> '向列表框中添加对象<BR> Dim count As Integer<BR> count = lstFile.ListCount<BR> If Y = 1 Then<BR> lstFile.AddItem FileNames(count), 0<BR> Else<BR> For i = 1 To Y - 1<BR> FileNames(i) = FileNames(0) & "\" & FileNames(i)<BR> lstFile.AddItem FileNames(i), i - 1 + count<BR> Next i<BR> End If<BR>errHandle:<BR>End Sub</P>
<P>Private Sub CommandButton1_Click()<BR> On Error GoTo errHandle<BR> <BR> Dim i As Integer<BR> Dim Y As Integer<BR> Dim z As Integer<BR> Dim FileNames() As String<BR> <BR> With comDlg<BR> .CancelError = True<BR> .MaxFileSize = 32767<BR> .Flags = cdlOFNHideReadOnly Or cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNNoDereferenceLinks<BR> .DialogTitle = "选择PC3文件"<BR> .filter = "数据文件(*.pc3)|*.pc3|所有文件(*.*)|*.*"<BR> .FileName = ""<BR> .ShowOpen<BR> End With<BR> TextBox1.Text = comDlg.FileName<BR>errHandle:<BR>End Sub</P>
<P>Private Sub CommandButton2_Click()<BR>On Error GoTo errHandle<BR> <BR> Dim i As Integer<BR> Dim Y As Integer<BR> Dim z As Integer<BR> Dim FileNames() As String<BR> <BR> With comDlg<BR> .CancelError = True<BR> .MaxFileSize = 32767<BR> .Flags = cdlOFNHideReadOnly Or cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNNoDereferenceLinks<BR> .DialogTitle = "选择CTB文件"<BR> .filter = "数据文件(*.ctb)|*.ctb|所有文件(*.*)|*.*"<BR> .FileName = ""<BR> .ShowOpen<BR> End With<BR> TextBox2.Text = comDlg.FileName<BR>errHandle:<BR>End Sub</P>
<P>Private Sub UserForm_Initialize()<BR> lstFile.Clear<BR> ComboBox1.AddItem ("ScaleToFit")<BR> ComboBox1.AddItem ("1:1")<BR> End Sub<BR>出错提示为:Run-time error '_2154386493(80200003)'</P>
<P>Invalid input</P>
<P>不知道为什么,请高手分析一下,谢谢!</P>
页:
[1]