word 设置
来源:互联网 发布:恶心的中国人知乎 编辑:程序博客网 时间:2024/05/01 10:22
Set WordApp = New Word.Application
WordApp.Documents.Add
Set doc = WordApp.ActiveDocument
Set se1 = WordApp.Selection
With doc.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.TopMargin = CentimetersToPoints(2)
.BottomMargin = CentimetersToPoints(2)
.LeftMargin = CentimetersToPoints(2)
.RightMargin = CentimetersToPoints(2)
.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
.GutterPos = wdGutterPosLeft
.LayoutMode = wdLayoutModeLineGrid
End With
字体:
wordApp.Selection.Font.Size = 9
'表格:
'本例只简单地设置了表格居中、自动调整表格列宽、表头居中、标题行重复、设置表格边框线、设置表格纵向居中
Temp_Table.Rows.Alignment = wdAlignRowCenter
Temp_Table.AutoFitBehavior wdAutoFitContent
Temp_Table.Rows(1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
Temp_Table.Rows(1).Range.Rows.HeadingFormat = wdToggle
Temp_Table.Borders(wdBorderLeft).LineWidth = wdLineWidth150pt
Temp_Table.Borders(wdBorderRight).LineWidth = wdLineWidth150pt
Temp_Table.Borders(wdBorderTop).LineWidth = wdLineWidth150pt
Temp_Table.Borders(wdBorderBottom).LineWidth = wdLineWidth150pt
Temp_Table.Range.Cells.VerticalAlignment = wdCellAlignVerticalCenter
'调用word打开word文档:
Dim wordApp As New Word.Application
Dim myDoc As Word.Document
wordApp = CreateObject("Word.Application")
With wordApp
.Visible = True
.Documents.Open(strPath)
End With
''释放变量
'wordApp.DisplayAlerts = False
'wordApp.Quit()
'myDoc = Nothing
'GC.Collect() '强制垃圾回收
'System.Runtime.InteropServices.Marshal.ReleaseC
'在表格里插入图片:
oTable.Rows(1).Cells(1).Range.InlineShapes.AddPicture("c: est.jpg")
WordApp.Documents.Add
Set doc = WordApp.ActiveDocument
Set se1 = WordApp.Selection
With doc.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.TopMargin = CentimetersToPoints(2)
.BottomMargin = CentimetersToPoints(2)
.LeftMargin = CentimetersToPoints(2)
.RightMargin = CentimetersToPoints(2)
.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
.GutterPos = wdGutterPosLeft
.LayoutMode = wdLayoutModeLineGrid
End With
字体:
wordApp.Selection.Font.Size = 9
'表格:
'本例只简单地设置了表格居中、自动调整表格列宽、表头居中、标题行重复、设置表格边框线、设置表格纵向居中
Temp_Table.Rows.Alignment = wdAlignRowCenter
Temp_Table.AutoFitBehavior wdAutoFitContent
Temp_Table.Rows(1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
Temp_Table.Rows(1).Range.Rows.HeadingFormat = wdToggle
Temp_Table.Borders(wdBorderLeft).LineWidth = wdLineWidth150pt
Temp_Table.Borders(wdBorderRight).LineWidth = wdLineWidth150pt
Temp_Table.Borders(wdBorderTop).LineWidth = wdLineWidth150pt
Temp_Table.Borders(wdBorderBottom).LineWidth = wdLineWidth150pt
Temp_Table.Range.Cells.VerticalAlignment = wdCellAlignVerticalCenter
'调用word打开word文档:
Dim wordApp As New Word.Application
Dim myDoc As Word.Document
wordApp = CreateObject("Word.Application")
With wordApp
.Visible = True
.Documents.Open(strPath)
End With
''释放变量
'wordApp.DisplayAlerts = False
'wordApp.Quit()
'myDoc = Nothing
'GC.Collect() '强制垃圾回收
'System.Runtime.InteropServices.Marshal.ReleaseC
'在表格里插入图片:
oTable.Rows(1).Cells(1).Range.InlineShapes.AddPicture("c: est.jpg")
- word 设置
- C#设置word颜色
- word个性化设置保存
- word 批量设置图片大小
- WORD设置标题格式
- word设置透明色
- word表格线设置
- word 设置默认字体
- Word 设置 问题
- word页面设置技巧
- word中设置页码
- word文档设置
- word页眉设置问题
- POI设置Word页边距
- word设置密码
- word 常规模板设置
- Aspose.word设置页眉
- word打印设置相关
- 从伟大步入平庸 Google正在死去!
- sql ---获取记录条数
- 项目管理中的心态对抗之二——企业管理者的心态分析
- C++版-----链表实现
- 媲美Windows!Ajaxwindows在线体验
- word 设置
- Qt源码分析之信号和槽机制
- xp 下安装sqlserver的问题
- #ifdef #ifndef extern "c"与头文件
- 感受K2.Net 2003工作流解决方案
- tomcat 6.0 + jdk 1.6 + sqlserver sp4 连接池配置(原创)
- TCP服务器模型
- hibernate模糊查询的几种方式
- .NET Framework概述