Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
H

hemananthan

@hemananthan
About
Posts
2
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Convert document to PDF format
    H hemananthan

    Can anybody help me programatically using COM components to get the solution for converting any type of document to PDF format we already tried through this coding: public static void ConverWordToPDF(string Filepath, string Targetpath) { object Unknown = Type.Missing; object Source = Filepath; object Target = Targetpath; ApplicationClass MSdoc = new ApplicationClass(); try { MSdoc.Visible = false; MSdoc.Documents.Open(ref Source, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown); MSdoc.Application.Visible = false; MSdoc.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMinimize; object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF; MSdoc.ActiveDocument.SaveAs(ref Target, ref format, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown); } catch (Exception e) { log.Info("Converted Word to PDF", e); } finally { if (MSdoc != null) { MSdoc.Documents.Close(ref Unknown, ref Unknown, ref Unknown); } MSdoc.Quit(ref Unknown, ref Unknown, ref Unknown); } } Normally in while runing this application in local its working fine in XP System: while run through IIS i getting the following error: System.Runtime.InteropServices.COMException (0x800A11FD): =================== System.Runtime.InteropServices.COMException (0x800A11FD): This method or property is not available because a document window is not active. at Microsoft.Office.Interop.Word.Documents.Close(Object& SaveChanges, Object& OriginalFormat, Object& RouteDocument) Can anybody suggest me how to resolve it or any new solution for conversion process

    Thanks Regards Hemananthan>S

    COM com help windows-admin tutorial

  • How to convert document to PDF format in Asp.net using c#
    H hemananthan

    Can anybody help me programatically to get the solution for converting any type of document to PDF format we already tried through this coding: public static void ConverWordToPDF(string Filepath, string Targetpath) { object Unknown = Type.Missing; object Source = Filepath; object Target = Targetpath; ApplicationClass MSdoc = new ApplicationClass(); try { MSdoc.Visible = false; MSdoc.Documents.Open(ref Source, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown); MSdoc.Application.Visible = false; MSdoc.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMinimize; object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF; MSdoc.ActiveDocument.SaveAs(ref Target, ref format, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown); } catch (Exception e) { log.Info("Converted Word to PDF", e); } finally { if (MSdoc != null) { MSdoc.Documents.Close(ref Unknown, ref Unknown, ref Unknown); } MSdoc.Quit(ref Unknown, ref Unknown, ref Unknown); } } Normally in while runing this application in local its working fine in XP System: while run through IIS i getting the following error: System.Runtime.InteropServices.COMException (0x800A11FD): =================== System.Runtime.InteropServices.COMException (0x800A11FD): This method or property is not available because a document window is not active. at Microsoft.Office.Interop.Word.Documents.Close(Object& SaveChanges, Object& OriginalFormat, Object& RouteDocument) Can anybody suggest me how to resolve it or any new solution for conversion process

    Thanks Regards Hemananthan.S ===============

    ASP.NET csharp help asp-net com windows-admin
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups