The sample demonstrates how to save a Word document to image with Spire.Doc.
private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();
document.LoadFromFile(@"..\..\..\..\..\..\Data\FindAndReplace.doc");
//Save doc file.
Image img = document.SaveToImages(0, ImageType.Bitmap);
img.Save("sample.bmp");
//Launching the image file.
WordDocViewer("sample.bmp");
}
private void WordDocViewer(string fileName)
{
try
{
System.Diagnostics.Process.Start(fileName);
}
catch { }
}
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
'Create word document
Dim document_Renamed As New Document()
document_Renamed.LoadFromFile("..\..\..\..\..\..\Data\FindAndReplace.doc")
'Save doc file.
Dim img As Image = document_Renamed.SaveToImages(0, ImageType.Bitmap)
img.Save("sample.bmp")
'Launching the image file.
WordDocViewer("sample.bmp")
End Sub
Private Sub WordDocViewer(ByVal fileName As String)
Try
Process.Start(fileName)
Catch
End Try
End Sub