word.visible wordapp.visible - 电脑技术中心 - 【漳州电脑网】_漳州电脑维修_漳州笔记本电脑维修_监控安装_市区上门维修

全国统一24小时服务热线:400-0000-000400-0000-000  / 1399000000

当前位置:首页 > 电脑技术中心 > 正文

word.visible wordapp.visible

发布日期:2020-10-12

摘要:如何用C NET处理WORD的事件导入COM库:Microsoft word 11 0 Object Library 引用里面就增加了:创建新Word object oMissing = System...

如何用C#NET处理WORD的事件

导入COM库:Microsoft word 11.0 Object Library.引用里面就增加了:创建新Word object oMissing = System.Reflection.Missing.Value; Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oWord.Visible = true; oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); 打开文档: object oMissing = System.Reflection.Missing.Value; Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oWord.Visible = true; object fileName = @"E:\CCCXCXX\TestDoc.doc"; oDoc = oWord.Documents.Open(ref fileName, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing); 导入模板 object oMissing = System.Reflection.Missing.Value; Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oWord.Visible = true; object fileName = @"E:\XXXCCX\Test.doc"; oDoc = oWord.Documents.Add(ref fileName, ref oMissing, ref oMissing, ref oMissing);.添加新表 object oMissing = System.Reflection.Missing.Value; Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oWord.Visible = true; oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); object start = 0; object end = 0; Word.Range tableLocation = oDoc.Range(ref start, ref end); oDoc.Tables.Add(tableLocation, 3, 4, ref oMissing, ref oMissing);.表插入行 object oMissing = System.Reflection.Missing.Value; Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oWord.Visible = true; oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); object start = 0; object end = 0; Word.Range tableLocation = oDoc.Range(ref start, ref end); oDoc.Tables.Add(tableLocation, 3, 4, ref oMissing, ref oMissing); Word.Table newTable = oDoc.Tables[1]; object beforeRow = newTable.Rows[1]; newTable.Rows.Add(ref beforeRow);.单元格合并 object oMissing = System.Reflection.Missing.Value; Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oWord.Visible = true; oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); object start = 0; object end = 0; Word.Range tableLocation = oDoc.Range(ref start, ref end); oDoc.Tables.Add(tableLocation, 3, 4, ref oMissing, ref oMissing); Word.Table newTable = oDoc.Tables[1]; object beforeRow = newTable.Rows[1]; newTable.Rows.Add(ref beforeRow); Word.Cell cell = newTable.Cell(1, 1); cell.Merge(newTable.Cell(1, 2));.单元格分离 object oMissing = System.Reflection.Missing.Value; Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oWord.Visible = true; oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); object start = 0; object end = 0; Word.Range tableLocation = oDoc.Range(ref start, ref end); oDoc.Tables.Add(tableLocation, 3, 4, ref oMissing, ref oMissing); Word.Table newTable = oDoc.Tables[1]; object beforeRow = newTable.Rows[1]; newTable.Rows.Add(ref beforeRow); Word.Cell cell = newTable.Cell(1, 1); cell.Merge(newTable.Cell(1, 2)); object Rownum = 2; object Columnnum = 2; cell.Split(ref Rownum, ref Columnnum); 通过段落控制插入 object oMissing = System.Reflection.Missing.Value; object oEndOfDoc = "\\endofdoc"; /**//* \endofdoc is a predefined bookmark */ //Start Word and create a new document. Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oWord.Visible = true; oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); //Insert a paragraph at the beginning of the document. Word.Paragraph oPara1; oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing); oPara1.Range.Text = "Heading 1"; oPara1.Range.Font.Bold = 1; oPara1.Format.SpaceAfter = 24; //24 pt spacing after paragraph. oPara1.Range.InsertParagraphAfter();

C#中导出word怎么动态生成标题

object oMissing = System.Reflection.Missing.Value;Word._Application oWord;Word._Document oDoc;oWord = new Word.Application();oWord.Visible = true;oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,ref oMissing, ref oMissing);

ppt文件怎么转换成word文件

PowerPoint 20031 运行PowerPoint 2003软件,单击菜单栏的“文件”按钮,打开的快捷菜单指向“发送”,在下一级菜单中单击“Microsoft Office Word”命令2 弹出“发送到 Microsoft Office Word”对话框,选择您喜欢的版式界面,然后在“将幻灯片添加到 Microsoft Office Word 文档”中一栏选择“粘贴”或“粘贴链接”方式 END PowerPoint 20101 运行PowerPoint 2010软件,单击左上角的“文件”按钮,出来的界面单击左侧的“保存并发送”选项2 在文件类型栏下单击“创建讲义”,然后在右侧界面中单击“创建讲义”按钮3 弹出跟PowerPoint 2003一样的界面,设置完成后单击“确定”按钮即可 END 使用脚本文件把PPT转换为Word 文档 在桌面上新建一个文本文档,将下面的代码复制进去"绑定到本地计算机 strComputer = ".""如果发生错误,继续执行 on error resume next Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") msgbox "此脚本可以批量将ppt文件中的文本转换为word文件。

图片、表格等内容则自动跳过" & vbcrlf & "使用时请把所有要转换的ppt文件复制到目录c:\下。

双击运行此文件即可。

" & vbcrlf & "运行此脚本需要本机上安装了office""创建一个word对象 Set objWord = CreateObject("Word.Application")"创建一个ppt对象 Set pptApp = CreateObject("PowerPoint.application")"获得c:\目录下的文件集合 Set FileList = objWMIService.ExecQuery _("ASSOCIATORS OF {Win32_Directory.Name="c:"} Where " _& "ResultClass = CIM_DataFile") For Each objFile In FileList"如果文件的扩展名是ppt If objFile.Extension = "ppt" Then pptApp.visible = true"打开这个ppt文件 Set pptSelection = pptApp.Presentations.Open("c:\" & objFile.FileName & "." & objFile.Extension)"如果想让脚本处理得快些,把下面一行改为“objWord.Visible = false”,不推荐。

objWord.Visible = true"新建一个word,以保存ppt中的文本 Set objDoc = objWord.Documents.Add() Set objSelection = objWord.Selection"从ppt的第一页开始循环。

Slides.Count即幻灯片的数量 For i = 1 To pptSelection.Slides.Count"从每一张ppt的第一个文本框开始循环,Shapes.Count,即每张幻灯片中文本框的数量 For j = 1 To pptSelection.Slides(i).Shapes.Count"如果是每页的第一行,就按标题处理,变成黑体字 if i =1 then objSelection.Font.Name = "黑体""把文本框中的文字添加到word中 objSelection.TypeText pptSelection.Slides(i).Shapes(j).TextFrame.TextRange.text objSelection.TypeParagraph() objSelection.Font.Name = "宋体" end if objSelection.TypeText pptSelection.Slides(i).Shapes(j).TextFrame.TextRange.text"加一个回车 objSelection.TypeText vbcrlf Next next"关闭这个ppt文件 pptSelection.close"保存word文件。

objDoc.SaveAs("c:\" & objFile.FileName & ".doc")"如果不需要关闭word,把下面这一行删掉 objDoc.close"如果不想弹出消息框,把下面这一行删掉 msgbox "转换后的word已保存在c:\" & objFile.FileName & ".doc" else "没有ppt文件"msgbox "错误:c:\下没有发现ppt文件!" End If Next pptApp.quit 在菜单栏点击“文件”——“另存为”命令 指定好要保存文件的位置,在文件名框中输入任意名称+vbs扩展名,然后单击“保存”按钮 此时会在桌面上生成vbs脚本文件,将要转换的PPT演示文稿放到C盘根目录,并执行vbs脚本文件 弹出以下提示对话框,直接单击“确定”按钮即可6 最后自动打开转换好的Word 文档并弹出以下提示对话框,单击“确定”按钮

如何在php中读取word的table和图片

// 建立一个指向新COM组件的索引 $word = new COM("word.application") or die("Can"t start Word!"); $word->Visible = 1; #打开一个新文档 $word->Documents->Add(); #写 $word->Selection->TypeText("This is my a test....."); #存 $word->Documents[1]->SaveAs("D:/tanfanlin.doc"); //打开文档$word->Documents->OPen("D:/tanfanlin.doc");echo $word->ActiveDocument->content->Text;//关闭 word$word->Quit();?>table 需要转换输出

vb按页拆分word文档时出现宏怎么操作

下面是按页拆分word文档的程序,请参考:Option ExplicitDim oWord As Word.ApplicationDim oDoc As Word.DocumentDim oNewDoc As Word.DocumentDim oRange As Word.RangeDim iPageNumber As IntegerDim iCount As IntegerDim strTestDir As StringDim strTestFile As StringPrivate Sub Command1_Click() Command1.Visible = False Dim lCurrentStart As Long Dim lCurrentEnd As Long Dim lDocumentEnd As Long Dim lOutputCount As Long lOutputCount = 0 "Launch Word and make it visible Set oWord = CreateObject("Word.Application") oWord.Visible = True "Open the test document Set oDoc = oWord.Documents.Open(FileName:="C:\ThreePageDocument.doc") "Find the beginning end of the document oDoc.Select lCurrentStart = oWord.Selection.Start lCurrentEnd = lCurrentStart lDocumentEnd = oWord.Selection.End "Move the insertion point to the beginning of the document oWord.Selection.Collapse wdCollapseStart Do While (lCurrentEnd < lDocumentEnd) "Move the insertion pointer to the bottom of this page oWord.Browser.Target = wdBrowsePage oWord.Browser.Next lCurrentEnd = oWord.Selection.End "On the last page, the start and end will be the same If (lCurrentStart = lCurrentEnd) Then lCurrentEnd = lDocumentEnd End If "Capture the Range of the current page Set oRange = oDoc.Range(lCurrentStart, lCurrentEnd) "Create a new document and copy the range to it Set oNewDoc = oWord.Documents.Add oRange.Copy oNewDoc.Range(0, 0).Paste "Release the Range so we don"t leak references Set oRange = Nothing "Save the new document and close it oNewDoc.SaveAs FileName:="C:\Result" & lOutputCount & ".doc" " You can save as another FileFormat. If so, change the " file extension accordingly. oNewDoc.Close Set oNewDoc = Nothing "Increment the output counter so we don"t overwrite this file later lOutputCount = lOutputCount + 1 "Reset the current start position lCurrentStart = oWord.Selection.End LoopEnd Sub

WORD模板文件的后缀名是什么?DimIAsIntegerDim?

你好,试试我这个吧刚刚测试完的。

/* @author axgle 直接用php把word文档转化成HTML文件 适用于windows和安装了word的环境 */ function word2html($wfilepath) { $word=new COM("Word.Application") or die("无法打开 MS Word"); $word->visible = 1 ; $word->Documents->Open($wfilepath)or die("无法打开这个文件"); $htmlpath= substr($wfilepath,0,-4); $word->ActiveDocument->SaveAs($htmlpath,8); $word->quit(0); } $w="G:/www/test.doc"; word2html($w); print( "Word转html完成!" ); ?>

vb.net 操作word问题 求大神

在专业论坛上找了一个:Sub Macro1()Dim p$, f$, s$, a, arr, brr(1 To 6000, 1 To 20), d As Object, i&, l&, m&Set d = CreateObject("scripting.dictionary")a = Array("aaa", "身份证号码", "年龄", "姓名", "性别", "工作", "职业", "兴趣", "住址")For i = 1 To UBound(a)d(a(i)) = iNextp = ThisWorkbook.Path & "\"With CreateObject("word.application").Visible = Falsef = Dir(p & "*.doc")Do While f "".Documents.Open p & fFor l = 1 To .ActiveDocument.Tables.CountWith .ActiveDocument.Tables(l)For i = 1 To .Rows.Counts = Replace(.Cell(i, 1).Range.Text, Chr(7), "")s = Left(s, Len(s) - 1)If d.Exists(s) Then brr(m + d(s), 2) = Replace(.Cell(i, 2).Range.Text, Chr(7), "")NextFor i = 1 To 8brr(m + i, 1) = a(i)NextEnd Withm = m + 9Next.ActiveDocument.Closef = DirLoop.QuitEnd WithSet MyWord = NothingActiveSheet.UsedRange.ClearContents[a1].Resize(m, 2) = brrEnd Sub

VBA Word Excel 数据交互

我是使用OFFICE 2003来做的,不知道你那好使不好使Private Sub CommandButton2_Click()"防止重复打开同一Word文档导致错误If Not WordDocIsOpen("F:\总工月报表.doc") Then"创建Word对象Set objWordApp = CreateObject("Word.Application")objWordApp.Visible = True"打开指定文档Set objDocument = objWordApp.Documents.Open("F:\总工月报表.doc")"获取当前Excel的SHEET1的单元格C2数据strName = ThisWorkbook.Sheets(1).Cells(2, 3).Value"将取得得值设定到Word表格的1行2列中objDocument.Tables(1).Cell(1, 2).Range.Text = strNameEnd IfEnd Sub"判断Word文档是否被重复打开Function WordDocIsOpen(ByVal strDocName As String) As BooleanDim objWordApp As ObjectDim objWordDoc As ObjectWordDocIsOpen = FalseSet objWordApp = NothingOn Error Resume NextstrDocName = UCase(strDocName)"判断是否有Word程序被打开Set objWordApp = GetObject(, "Word.Application")If Not objWordApp Is Nothing Then"判断指定Word文件是否被打开For Each objWordDoc In objWordApp.DocumentsIf UCase(objWordDoc.FullName) = strDocName ThenWordDocIsOpen = TrueExit ForEnd IfNextEnd IfSet objWordDoc = NothingSet objWordApp = NothingEnd Function

上一篇:控制型人力资源管理软件 人力资源管理控制程序

下一篇:查看电脑中所以软件 电脑查看图片的软件