the command is not available because no document is open
-
hi guys i m using asp.net an C# im trying to convert .docx to html when i use my machine documents open and also easily converted to html,,my machine have (xp sp2,visual studio2008,MS Office 2007) when i go for client pc when i click convert button i m getting error like this "the command is not available because no document is open"
Microsoft.Office.Interop.Word.ApplicationClass wordApplication = new ApplicationClass();
object o_nullobject = System.Reflection.Missing.Value;
String strfiletoupload = @"C:\inetpub\wwwroot\wss\VirtualDirectories\12122\uploaded\template\DeveloperEmail.docx";
object o_filePath = strfiletoupload;
Microsoft.Office.Interop.Word.Document doc = wordApplication.Documents.Open(ref o_filePath,
ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject,
ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject,
ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject);
object o_newfilename = @"C:\inetpub\wwwroot\wss\VirtualDirectories\12122\uploaded\template\NewsletterEmail.html";
object o_format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatFilteredHTML;
//object o_format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatHTML;
object o_encoding = Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8;
object o_endings = Microsoft.Office.Interop.Word.WdLineEndingType.wdCRLF;
//Microsoft.Office.Interop.Word.wd
object o_BiDiMark = true;wordApplication.ActiveDocument.SaveAs(ref o\_newfilename, ref o\_format, ref o\_nullobject, ref o\_nullobject, ref o\_nullobject, ref o\_nullobject, ref o\_nullobject, ref o\_BiDiMark, ref o\_BiDiMark, ref o\_nullobject, ref o\_nullobject, ref o\_encoding, ref o\_nullobject, ref o\_nullobject, ref o\_endings, ref o\_BiDiMark); doc.Close(ref o\_nullobject, ref o\_nullobject, ref o\_nullobject); wordApplication.Quit(ref o\_nullobject, ref o\_nullobject, ref o\_nullobject); System.Runtime.InteropServ
-
hi guys i m using asp.net an C# im trying to convert .docx to html when i use my machine documents open and also easily converted to html,,my machine have (xp sp2,visual studio2008,MS Office 2007) when i go for client pc when i click convert button i m getting error like this "the command is not available because no document is open"
Microsoft.Office.Interop.Word.ApplicationClass wordApplication = new ApplicationClass();
object o_nullobject = System.Reflection.Missing.Value;
String strfiletoupload = @"C:\inetpub\wwwroot\wss\VirtualDirectories\12122\uploaded\template\DeveloperEmail.docx";
object o_filePath = strfiletoupload;
Microsoft.Office.Interop.Word.Document doc = wordApplication.Documents.Open(ref o_filePath,
ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject,
ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject,
ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject);
object o_newfilename = @"C:\inetpub\wwwroot\wss\VirtualDirectories\12122\uploaded\template\NewsletterEmail.html";
object o_format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatFilteredHTML;
//object o_format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatHTML;
object o_encoding = Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8;
object o_endings = Microsoft.Office.Interop.Word.WdLineEndingType.wdCRLF;
//Microsoft.Office.Interop.Word.wd
object o_BiDiMark = true;wordApplication.ActiveDocument.SaveAs(ref o\_newfilename, ref o\_format, ref o\_nullobject, ref o\_nullobject, ref o\_nullobject, ref o\_nullobject, ref o\_nullobject, ref o\_BiDiMark, ref o\_BiDiMark, ref o\_nullobject, ref o\_nullobject, ref o\_encoding, ref o\_nullobject, ref o\_nullobject, ref o\_endings, ref o\_BiDiMark); doc.Close(ref o\_nullobject, ref o\_nullobject, ref o\_nullobject); wordApplication.Quit(ref o\_nullobject, ref o\_nullobject, ref o\_nullobject); System.Runtime.InteropServ
Hi vimal, try these links, mayb helpful for u. http://msdn.microsoft.com/en-us/magazine/cc163526.aspx.[^] HTML to WordML[^]