C
Corby Nichols
I am trying to use DsoFramer to display a word document
and the code below words fine, but I dont want to
use the ShowDialog method as was done here.
/// <summary>
/// This method finds Word (if running) and
/// sets Word to run in this control
/// </summary>
public bool LoadWordDocument()
{
// initial value
bool wordLoaded = false;
try
{
// Navigate to the word doc
this.FrameControl.ShowDialog(DSOFramer.dsoShowDialogType.dsoDialogOpen);
}
catch
{
// Show message to user
MessageBox.Show("Unable to load document");
}
// return value
return wordLoaded;
}
I was able to open the word doc my self using:
Word.Application wordApp = null;
Word.Document wordDoc = null;
object missing = System.Reflection.Missing.Value;
object fileName2 = (object) fileName;
object readOnly = false;
object isVisible = true;
wordApp = new Word.ApplicationClass();
wordApp.Visible = true;
wordApp.Height = wordApp.System.VerticalResolution;
wordApp.Width = wordApp.System.HorizontalResolution;
wordDoc = wordApp.Documents.Open(ref fileName2, ref missing, ref
readOnly, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref isVisible, ref missing, ref
missing, ref missing, ref missing);
wordDoc.Activate();
// return value
return wordDoc;
I found this code in this group, and this works to open the document
and then I can set the FrameControl.Document using
this.FrameControl.Open(wordDoc);
The problem with this method is it launches Word
which I dont want.
Does anyone know a way I can set DsoFrame to open the document by a file
name (full path) without the Dialog?
Many thanks,
Corby Nichols
Houston, Texas
and the code below words fine, but I dont want to
use the ShowDialog method as was done here.
/// <summary>
/// This method finds Word (if running) and
/// sets Word to run in this control
/// </summary>
public bool LoadWordDocument()
{
// initial value
bool wordLoaded = false;
try
{
// Navigate to the word doc
this.FrameControl.ShowDialog(DSOFramer.dsoShowDialogType.dsoDialogOpen);
}
catch
{
// Show message to user
MessageBox.Show("Unable to load document");
}
// return value
return wordLoaded;
}
I was able to open the word doc my self using:
Word.Application wordApp = null;
Word.Document wordDoc = null;
object missing = System.Reflection.Missing.Value;
object fileName2 = (object) fileName;
object readOnly = false;
object isVisible = true;
wordApp = new Word.ApplicationClass();
wordApp.Visible = true;
wordApp.Height = wordApp.System.VerticalResolution;
wordApp.Width = wordApp.System.HorizontalResolution;
wordDoc = wordApp.Documents.Open(ref fileName2, ref missing, ref
readOnly, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref isVisible, ref missing, ref
missing, ref missing, ref missing);
wordDoc.Activate();
// return value
return wordDoc;
I found this code in this group, and this works to open the document
and then I can set the FrameControl.Document using
this.FrameControl.Open(wordDoc);
The problem with this method is it launches Word
which I dont want.
Does anyone know a way I can set DsoFrame to open the document by a file
name (full path) without the Dialog?
Many thanks,
Corby Nichols
Houston, Texas