Click here to Skip to main content
15,886,104 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I want to prepare Offer using Third party dll file...
Here is my code..
C#
protected void Page_Load(object sender, EventArgs e)
  {
      Spire.Doc.Document document = new Spire.Doc.Document();
      document.LoadFromFile(Server.MapPath("~\\Vijju offer letter.docx"));

      //Convert to PDF and Launch PDF
      document.SaveToFile("Word2PDF.PDF", FileFormat.PDF);
      System.Diagnostics.Process.Start("Word2PDF.PDF");
  }

I got an exception at second line "
SQL
Current file path is not exits.

but i have a .docx file..but it shows an exception..
please help me...
Thanks In Advance..
Posted
Updated 17-Aug-14 19:02pm
v3

 
Share this answer
 
Comments
[no name] 16-Aug-14 3:34am    
Hi..i used first link and i got an Exception
object outputFileName = wordFile.FullName.Replace(".doc", ".pdf"); line
like "COMException was Unhandled by user code
Unspecified error"

How can i solve this
[no name] 16-Aug-14 6:16am    
Please do this

add a reference to Microsoft.Office.Interop.Word to the solution.
hi,

You can try to put your .doc file in folder that contains .csproj, then load the file using

document.LoadFromFile(Server.MapPath("~\\Vijju offer letter.docx"));


Or load the .doc file directly by its relative path

document.LoadFromFile(@"E:\..\..\Vijju offer letter.docx");
 
Share this answer
 
Your path must be full name consist of your doc also. Try this;

C#
private string path = @"D:\archemendo\doc\";
private string fileName_word1 = "Arche.docx";

public void WordTest() 
{
   document.LoadFromFile(path + fileName_word1);
   RunWordFile(path + fileName_word1);
}

public void RunWordFile(string fileName) {
try 
{
  System.Diagnostics.Process.Start(fileName);
}
catch(Exception ex)
{
  return;
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900