word-2013

Word VSTO - Filling a shape does not work in Word 2010 and Word 2013?

心已入冬 提交于 2019-12-20 05:46:09
问题 I use the following VB.NET (VSTO) code to add a shape in MS-Word, Dim app As Word.Application = Globals.ThisAddIn.Application Dim doc As Word.Document = app.ActiveDocument Dim left As Single = CSng(Convert.ToDouble(app.Selection.Information(Word.WdInformation.wdHorizontalPositionRelativeToPage))) Dim top As Single = CSng(Convert.ToDouble(app.Selection.Information(Word.WdInformation.wdVerticalPositionRelativeToPage))) Dim shape As Word.Shape = doc.Shapes.AddShape(1, left, top, 225.1F, 224.5F)

Selected printer-tray does not print Word document

点点圈 提交于 2019-12-13 16:18:06
问题 I have an application (word-addin), which has a class that should print a Word-document at a selected printer & tray. It's working now, but it ignores the selected tray and always prints from manual feed. My class is the following: class printerManager { String printer_name; String paperSource_name; public printerManager(String printerName, String paperSourceName) { printer_name = printerName; paperSource_name = paperSourceName; } public void print() { Microsoft.Office.Interop.Word

Word 2013 VBA - opening document aborts macro

可紊 提交于 2019-12-12 03:27:15
问题 I'm running pretty simple VBA in Word: Sub Something On Error GoTo prob Dim d As Document Set d = Documents.Open(FileName:="c:\ajb files\test.docx") 'this should run if macro succeeds MsgBox "ok" Exit Sub 'this should run if macro fails prob: MsgBox "prob" End Sub This macro opens the Word document then stops (without triggering an error message). I tried running the same macro in Word 2010 and it works fine. I haven't got an Acer laptop, or any weird anti-virus or other software running. I

VBA(?) How to extract filename of images linked and inserted - Word 2013

喜夏-厌秋 提交于 2019-12-11 21:12:45
问题 We insert and link pictures (insert picture from file .emf) in our Word documents (.docx). Our documents and the graphic files are stored on our network drives. We then provide our documents to the authors to be worked on. The pictures in the documents are useful for the authors. How do I programmatically and globally (document wise, not batch processing documents): Extract the filename (without the file extension) of the pictures linked and inserted? We have a tool that exports the Word

Pywin32 save .docx as pdf

我的未来我决定 提交于 2019-12-10 03:15:01
问题 I'm using Word 2013 to automatically create a report as a docx and then save it as a pdf format. But when I call the function SaveAs2(), the script pop out the "save as" windows and throws this exception : (-2147352567, 'Exception occurred.', (0, u'Microsoft Word', u'Command failed', u'wdmain11.chm', 36966, -2146824090), None) Here is my code to open and to save as a new file: self.path = os.path.abspath(path) self.wordApp = win32.Dispatch('Word.Application') #create a word application object

Pywin32 save .docx as pdf

一曲冷凌霜 提交于 2019-12-05 02:16:34
I'm using Word 2013 to automatically create a report as a docx and then save it as a pdf format. But when I call the function SaveAs2(), the script pop out the "save as" windows and throws this exception : (-2147352567, 'Exception occurred.', (0, u'Microsoft Word', u'Command failed', u'wdmain11.chm', 36966, -2146824090), None) Here is my code to open and to save as a new file: self.path = os.path.abspath(path) self.wordApp = win32.Dispatch('Word.Application') #create a word application object self.wordApp.Visible = False # if false hide the word application (app does't open but still usable)

Looping through the parts of a non-contiguous selection in MS *Word* VBA

你说的曾经没有我的故事 提交于 2019-12-04 05:28:59
问题 I have a macro in MS Word 2013 VBA ( not Excel) that toggles the selected text's highlight color. Code looks like this: If Selection.Range.HighlightColorIndex = WhtColor Then Selection.Range.HighlightColorIndex = wdNoHighlight Else Selection.Range.HighlightColorIndex = WhtColor That works great for continuous/contiguous selections. But, if I select, say, 4 non-contiguous rows in a Word table (say, rows 5, 12, 15, and 19), the macro highlights only the last row selected. How do I get the

“You are not allowed to edit this selection because it is protected.” but only since Office 2013?

£可爱£侵袭症+ 提交于 2019-12-04 02:57:29
We've had these few lines of code running happily in our applications for several years (and in several versions of Office, 2003, 2007, 2010 etc). Purpose is to perform a kind of a mail merge in a Word document, substituting the field placeholders with names, addresses etc from a database: Dim w As Word.Application Dim d As Microsoft.Office.Interop.Word.Document = Nothing ... Dim f As Microsoft.Office.Interop.Word.Field For Each f In d.Fields f.Select() If fieldName = w.Selection.Text Then f.Result.Text = value End If Next However a user running Office 2013 reports this error on the line f

Word VSTO - Filling a shape does not work in Word 2010 and Word 2013?

…衆ロ難τιáo~ 提交于 2019-12-02 12:37:51
I use the following VB.NET (VSTO) code to add a shape in MS-Word, Dim app As Word.Application = Globals.ThisAddIn.Application Dim doc As Word.Document = app.ActiveDocument Dim left As Single = CSng(Convert.ToDouble(app.Selection.Information(Word.WdInformation.wdHorizontalPositionRelativeToPage))) Dim top As Single = CSng(Convert.ToDouble(app.Selection.Information(Word.WdInformation.wdVerticalPositionRelativeToPage))) Dim shape As Word.Shape = doc.Shapes.AddShape(1, left, top, 225.1F, 224.5F) shape.Fill.BackColor.RGB = ColorTranslator.ToOle(Color.Transparent) shape.Fill.Visible = Microsoft

Word Automation from IIS

怎甘沉沦 提交于 2019-11-30 09:52:48
问题 I created a Windows application which starts a Word process (Microsoft.Office.Interopt.Word) with C#. I load two addins word.AddIns.Add(@"C:\temp\addin.dot", true);. This code works perfectly fine within my windows application. To be able to start this process remotly, I created a MVC web application. The web app uses the same code, but it failes on the part where I load the addins: error: Word cannot open this document template: (C:\temp\addin.dot) The web application uses an application