B
Big Daddy
I am trying to use VSTO & C# to iterate over each page of the document and
print it to a MDI doc.
when i get to the print out part the it seems as though it is showing a
print dialog or something but its not visable, the code just hangs. My
code: (there is some other misc bs )
Word.Application app;
Office.CommandBarButton btn;
Office.CommandBarComboBox cboBox;
object UnitLine = Word.WdUnits.wdLine;
object UnitStory = Word.WdUnits.wdStory;
object wdExtend =Word.WdMovementType.wdExtend;
object wdMove = Word.WdMovementType.wdMove;
object mkTrue = true;
object OutputfileName ;
private void MDIOut()
{
string remove,fileName;
object prtCurrentPage =Word.WdPrintOutRange.wdPrintCurrentPage;
ActiveWindow.ActivePane.View.SeekView =
Word.WdSeekView.wdSeekCurrentPageHeader;
app.Selection.HomeKey(ref UnitStory , ref wdMove);
app.Selection.EndKey(ref UnitLine, ref wdExtend);
MessageBox.Show(app.Selection.Text);
app.ActivePrinter = "Microsoft Office Document Image Writer";
for (int i = 0; i <= app.ActiveDocument.Sections.Count; i++)
{
ActiveWindow.ActivePane.View.SeekView =
Microsoft.Office.Interop.Word.WdSeekView.wdSeekMainDocument;
//ref OutputfileName
fileName = "C:\\File" + i + ".doc";
app.PrintOut( ref missing , ref missing, ref prtCurrentPage,ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref mkTrue, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing );
}
print it to a MDI doc.
when i get to the print out part the it seems as though it is showing a
print dialog or something but its not visable, the code just hangs. My
code: (there is some other misc bs )
Word.Application app;
Office.CommandBarButton btn;
Office.CommandBarComboBox cboBox;
object UnitLine = Word.WdUnits.wdLine;
object UnitStory = Word.WdUnits.wdStory;
object wdExtend =Word.WdMovementType.wdExtend;
object wdMove = Word.WdMovementType.wdMove;
object mkTrue = true;
object OutputfileName ;
private void MDIOut()
{
string remove,fileName;
object prtCurrentPage =Word.WdPrintOutRange.wdPrintCurrentPage;
ActiveWindow.ActivePane.View.SeekView =
Word.WdSeekView.wdSeekCurrentPageHeader;
app.Selection.HomeKey(ref UnitStory , ref wdMove);
app.Selection.EndKey(ref UnitLine, ref wdExtend);
MessageBox.Show(app.Selection.Text);
app.ActivePrinter = "Microsoft Office Document Image Writer";
for (int i = 0; i <= app.ActiveDocument.Sections.Count; i++)
{
ActiveWindow.ActivePane.View.SeekView =
Microsoft.Office.Interop.Word.WdSeekView.wdSeekMainDocument;
//ref OutputfileName
fileName = "C:\\File" + i + ".doc";
app.PrintOut( ref missing , ref missing, ref prtCurrentPage,ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref mkTrue, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing );
}