ms-word

How do I display the next month in a Microsoft Word field?

*爱你&永不变心* 提交于 2020-01-03 03:37:05
问题 I'm needing to display the name of the month after the current month in a Word 2003 document. It's fairly easy to display the current month: { DATE \@ "MMMM" } At the time of this writing, this displays: September What I'm wanting to display is October...and for the life of me I cannot work out what needs to be done. I've been trying to follow the advice on addbalance but without much luck: { = { Date \@ "MMMM" } + 1 } Does anyone know what command I need to write to be able to accomplish

Preserve formatting of Word table in Excel VBA

落花浮王杯 提交于 2020-01-03 03:05:27
问题 From another discussion, I was able to find this macro that imports a table from Word into Excel. It works great but how I can make it keep the formatting of the Word table? I have tried a few ways but can't quite get it working. Also is there a way to do more files at once and not just 1 at a time? Option Explicit Sub ImportWordTable() Dim wdDoc As Object Dim wdFileName As Variant Dim tableNo As Integer 'table number in Word Dim iRow As Long 'row index in Excel Dim iCol As Integer 'column

Apache poi: remove Picture in XWPFDocument

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 02:25:31
问题 I'm writing an application that takes a .docx file with a bunch of empty paragraphs and tables and fills them programmatically using Apache POI with data from a db. The .docx model I've been provided with also has a serie of pictures in it: my problem is I'd like to remove the ones I don't need (again, programmatically). I see there is a method for adding pictures to a XWPFRun (addPicture()) but not one for removing them. Can this be done? How do you remove a picture from a .docx file with

`EOleException: Call was rejected by callee` while iterating through `Office.Interop.Word.Documents`

半世苍凉 提交于 2020-01-03 01:10:46
问题 I've been working with Word2010.pas for the past week and everything went well, until I found out that if you open a document manually , edit it (but don't save), press Alt+F4 , a prompt will show up saying if you want to save your document or not, leave it like that. Go into code and try to access that document , all calls will result in EOleException: Call was rejected by callee . Once you cancel that Word save prompt, everything works fine. I came across this while writing code that

`EOleException: Call was rejected by callee` while iterating through `Office.Interop.Word.Documents`

限于喜欢 提交于 2020-01-03 01:10:21
问题 I've been working with Word2010.pas for the past week and everything went well, until I found out that if you open a document manually , edit it (but don't save), press Alt+F4 , a prompt will show up saying if you want to save your document or not, leave it like that. Go into code and try to access that document , all calls will result in EOleException: Call was rejected by callee . Once you cancel that Word save prompt, everything works fine. I came across this while writing code that

Embedding a word file as a resource

左心房为你撑大大i 提交于 2020-01-02 23:04:16
问题 I am trying to access a word file from my c# code. I want to embed it as part of a project so that when i call a word doc object to be read from an aspx page, the object should have access to that word doc no matter where it is being used from. So how can i include a word doc as a resource in my project? Also in order to open my word doc, i need a path for that doc. After i have included the file as a resource, how do i somehow get its "path" so the word doc object can be created? Is there

How to Convert doc to jpg in .net

雨燕双飞 提交于 2020-01-02 15:55:27
问题 How can i convert doc/docx files to jpgs in ASP.Net. I don't want to install MS Word in server & use interop lib. Update My scenario is that I need to show Word document pages, page by page to the user in a web page like google docs viewer. 回答1: Interop on server/ASP.NET scenario is not supported by MS - see http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2. There are some 3rd-party libs for this sort of thing without automation and with high-fidelity and several other

how to judge if the file is doc or docx in POI

廉价感情. 提交于 2020-01-02 14:52:20
问题 The title may be a little confusing. The simplest method must be judging by extension name just like: // is represents the InputStream if (filePath.endsWith("doc")) { WordExtractor ex = new WordExtractor(is); text = ex.getText(); ex.close(); } else if(filePath.endsWith("docx")) { XWPFDocument doc = new XWPFDocument(is); XWPFWordExtractor extractor = new XWPFWordExtractor(doc); text = extractor.getText(); extractor.close(); } This works in most cases. But I have found that for certain file

Write HTML content to word document using C#

雨燕双飞 提交于 2020-01-02 14:31:38
问题 I am dynamically generating a word document and need to replace my special tags using a html content which is generated using CKeditor control. Here the word document i am using is a template which contains pre entered texts and for generating document i am using Microsoft.Office.Interop.Word. Now i can find my special tag using interop's doc.range.Find methord. But when i want to replace this tag with a HTML content without losing its style. how can i do this? using doc.range.Find

Runtime error 462 Excel VBA using Word

此生再无相见时 提交于 2020-01-02 10:02:25
问题 I keep getting the 462 error the second or third time I run this loop. I don't think I have any objects that are floating but maybe I missed something, I am kind of new at this. This macro is taking all the charts from Excel, pasting them into Word as pictures, resizing them, saving the document and closing it. The For loop has formatting for the chart to be pasted as a normal picture and the text below it to be caption so I can create a figure table easily. The error takes place in the