C#处理word横向问题,有谁可以直接给代码设置成横向的,或者我用word宏来解决,怎么转化为C#代码?

shmilqdd 2008-12-18 12:57:26
Sub Macro2()
With ActiveDocument.Styles(wdStyleNormal).Font
If .NameFarEast = .NameAscii Then
.NameAscii = ""
End If
.NameFarEast = ""
End With
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(29.7)
.PageHeight = CentimetersToPoints(21)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
.LayoutMode = wdLayoutModeLineGrid
End With
End Sub
...全文
485 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
fysz007 2011-03-17
  • 打赏
  • 举报
回复
对了,能问一下 用C # 横向之后,word 我想分2栏 怎么办?
fysz007 2011-03-17
  • 打赏
  • 举报
回复
顶 3楼的和 楼主 谢谢你们了 太感谢了
shmilqdd 2008-12-19
  • 打赏
  • 举报
回复
呵呵,我分不多
一楼的朋友有点帮助给了5分,三楼的兄弟谢谢了!!!
shmilqdd 2008-12-19
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 gswwn 的回复:]
设置为横版
wordApp.Selection.PageSetup.Orientation=word.WdOrientation.wdOrientLandscape;
[/Quote]

给你再修改点,应该是
WordApp.Selection.PageSetup.Orientation = Microsoft.Office.Interop.Word.WdOrientation.wdOrientLandscape;
不然提示你没有word
呵呵,万分感谢,要的就是这个
Perfect
gswwn 2008-12-18
  • 打赏
  • 举报
回复
设置为横版
wordApp.Selection.PageSetup.Orientation=word.WdOrientation.wdOrientLandscape;
shmilqdd 2008-12-18
  • 打赏
  • 举报
回复
word模板?
可是我想要用winform代码生成word文档的……
默认的是纵向板式的,我想设置成横向的,方便打印
shizheyangde 2008-12-18
  • 打赏
  • 举报
回复
不太明白楼主的意思,
word模板好像能解决你的问题,就是.dot结尾的word模板,把模板设置为你要的样式,然后向里面填充内容

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧