Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi i have a application in c# and need help with word and pdf viewer with the option print. is developed in forms, Any suggestion? thanks for the comments and help
Posted
Comments
Sergey Alexandrovich Kryukov 25-Apr-13 22:30pm    
Suggestions? Hard work. Any more specific questions?
—SA
hugojim 25-Apr-13 23:14pm    
i need develop a module to display documents Word, i read the document and save, but i need, the viewer document in the application with c# win forms framework net 4.0, vs 2010, office 07-10, try whit web browser but not keep the format word... tnks

1 solution

 
Share this answer
 
Comments
hugojim 26-Apr-13 11:10am    
i need develop a module to display documents Word, i read the document and save, but i need, the viewer document in the application with c# win forms framework net 4.0, vs 2010, office 07-10, try whit web browser but not keep the format word... tnks
nitin bhoyate 26-Apr-13 12:00pm    
can you post what you tried yet
hugojim 26-Apr-13 18:00pm    
hi this is the code, i can open word and then open de viewer, but i need open only the viewer.

other way is with printfielddialog, but i don know how is the code to do it.

void PrintDocument( string fileName)
{
object m = System.Reflection.Missing.Value;
object oldFileName = (object)fileName;
object readOnly = (object)false;
Word.Application app = null;

try
{

app = (Word.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Word.Application"));
Document doc = app.Documents.Open(
ref oldFileName, ref m, ref readOnly,
ref m, ref m, ref m, ref m, ref m, ref m, ref m,
ref m, ref m, ref m, ref m, ref m, ref m);


string tempFileName = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) + g.ToString() + ".html";
object newFileName = (object)fileName;
doc.PrintOut(
ref oldFileName, ref m, ref m,
ref m, ref m, ref m, ref m, ref m, ref m, ref m,
ref m, ref m, ref m, ref m, ref m, ref m, ref m);

Save the file.
doc.PrintPreview();
app.PrintPreview = true;
}
finally
{
if (app != null)
app.Quit(ref readOnly, ref m, ref m);
}
hugojim 26-Apr-13 18:03pm    
sorry is printpreviewdialog¡

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