ms-word

Streaming In Memory Word Document using OpenXML SDK w/ASP.NET results in “corrupt” document

你离开我真会死。 提交于 2019-12-30 05:43:26
问题 I am unable to stream a word document that I create on the fly down to the browser. I am constantly getting a message from Microsoft Word that the document is corrupt. When I run the code via a Console Application and take ASP.NET out of the picture, the document is generated correctly with no problems. I believe everything centers around writing the file down. Here is my code: using (MemoryStream mem = new MemoryStream()) { // Create Document using (WordprocessingDocument wordDocument =

Convert of word file(.docx & doc) to .pdf using c# is not working

此生再无相见时 提交于 2019-12-30 05:18:07
问题 I am using visualstudio 2010 and I am trying to convert word.docx file to .pdf file and is working fine in local but on run time on server it is showing error as Could not load file or assembly 'office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. What I have tried is added reference and put in bin folder Microsoft.Office.Interop.Word.dll Microsoft.Office.Interop.Word.xml as shown in figure my .cs

How to copy a paragraph of .docx to another .docx with Java and retain the style

只愿长相守 提交于 2019-12-30 05:01:08
问题 I am trying to copy the content from a particular paragraph in a .docx to another empty .docx .the problem i have is that the style,bullets,numbering etc from the source.docx is not retained in the destination .docx.Here is my code can anyone please tell me what are the changes to be added to the above code? Thanks in Advance!! public class WordFinal { public static void main(String[] args) throws IOException, XmlException { XWPFDocument doc = new XWPFDocument(new FileInputStream("source.docx

using win32com.client in python how to find and replace multiple text

不问归期 提交于 2019-12-30 03:31:44
问题 I'm trying to add multiple string values to a Word document using find and replace with the win32com.client Python library. I can find and replace one value, but I don't know how to do this for multiple values. This is what I have so far: import win32com.client word = win32com.client.DispatchEx("Word.Application") word.Visible = True word.DisplayAlerts = 0 word.Documents.Open("C:\TEMP\Testing\Me.docx") word.Selection.Find find.Text = "First Name" find.Replacement.Text = "John" find.Execute

How to add subscript characters in paragraphs using Word Automation?

被刻印的时光 ゝ 提交于 2019-12-30 03:27:06
问题 I’m working on a program in C# that uses Microsoft Word 14.0 Object Library to create a .doc file, add paragraphs to it and saves it. There is a small form with a button that does described actions (see the code below). This part has no problems. Problem: Current text in created word file will be the following: Some text beff = 3.0 What I need to accomplish, is creating a paragraph, which has subscript characters inside.(in paragraph above letters "eff" should be subscripted): The final

how can I convert pdf file to word file using Java [closed]

偶尔善良 提交于 2019-12-30 02:25:06
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . How can I convert a pdf file to word file using Java? And, is it as easy as it looks like? 回答1: Try PDFBOX public class PDFTextReader { static String pdftoText(String fileName) { PDFParser parser; String parsedText = null; PDFTextStripper pdfStripper = null; PDDocument pdDoc =

Word VSTO - Change the absolute positions' type?

萝らか妹 提交于 2019-12-29 09:48:29
问题 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)

How to check if a word file has a password?

懵懂的女人 提交于 2019-12-29 08:29:49
问题 I built a script that converts .doc files to .docx . I have a problem that when the .doc file is password-protected, I can't access it and then the script hangs. I am looking for a way to check if the file has a password before I open it. I using Documents.Open method to open the file. 回答1: If your script hangs on opening the document, the approach outlined in this question might help, only that in PowerShell you'd use a try..catch block instead of On Error Resume Next : $filename = "C:\path

Using Microsoft.Office.Interop.Word in asp.net

跟風遠走 提交于 2019-12-29 08:26:08
问题 I'm attempting to leverage the Microsoft.Office.Interop.Word dll in my asp.net application. Long story short, an internal web based document management/editing system requires access to a MS Word flesch-kincaid value on an ad-hoc basis. I have no problem using this dll in a console app, but I can't get the right permissions to it when accessed via asp.net. Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error:

How to save doc file using C#

六眼飞鱼酱① 提交于 2019-12-29 08:15:05
问题 I have been using the following to code to write in word file but not able to store the word file. Is there any way to store the word file using C# ? object oMissing = System.Reflection.Missing.Value; object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */ //Start Word and create a new document. Microsoft.Office.Interop.Word._Application oWord = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word._Document oDoc = new Microsoft.Office.Interop.Word