怪事?(100分)

  • 主题发起人 主题发起人 火鸟
  • 开始时间 开始时间

火鸟

Unregistered / Unconfirmed
GUEST, unregistred user!
在用D5加Texcelworksheet时,如要设置自定义纸张时
Texcelworksheet.pagesetup.papersize=xlpaperuser
运得时却发生一个错误
同样我在excel97中通过宏来实现,
sheet1.papersize=xlpaperuser 一运行
也会发生同样的错误(不能设置papesize的属性)

 
没人加答吗?
 
你可一在VBA 中单步执行看看xlpaperuser的值,然后知己定义一些常量
一般xlpaperuser是整型的
如:xlPaperA3=8
 
不能哪样作的,见下面的宏,
在Delphi中也是一样作的。


With ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.TopMargin = CentimetersToPoints(3.17)
.BottomMargin = CentimetersToPoints(3.17)
.LeftMargin = CentimetersToPoints(2.54)
.RightMargin = CentimetersToPoints(2.54)
.Gutter = CentimetersToPoints(0)
.HeaderDistance = CentimetersToPoints(1.5)
.FooterDistance = CentimetersToPoints(1.75)
.PageWidth = CentimetersToPoints(42)
.PageHeight = CentimetersToPoints(29.7)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.GutterOnTop = False
.CharsLine = 99
.LinesPage = 42
End With
End Sub
 
to 程云:
在excel里好象没有activedocument这个对象,它在word里的
所以好象这种方法不行吧
 
写错了,我把word的给写出来了,
其实都差不多的。
见如下

With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA3
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
End Sub

安照这个样子,可以在Delphi中完成的。
 
程云:
可如果 xlpapersize=xlpaperuser 就出错了
 
接受答案了.
 

Similar threads

D
回复
0
查看
822
DelphiTeacher的专栏
D
D
回复
0
查看
828
DelphiTeacher的专栏
D
D
回复
0
查看
663
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部