UseOfficeeOfficeVersion Enumeration |
Allows to get a current MS Office version.
Namespace: SautinSoftAssembly: UseOffice (in UseOffice.dll) Version: 2024.12.12
Syntax public enum eOfficeVersion
Public Enumeration eOfficeVersion
Members Member name | Value | Description |
---|
Unknown | 0 |
An unknown version. Just in case, the property is filled after the invoking of InitWord() method.
|
Office2000 | 9 |
MS Office 2000. Integer value is 9.
|
OfficeXP | 10 |
MS Office XP. Integer value is 10.
|
Office2003 | 11 |
MS Office 2003. Integer value is 11.
|
Office2007 | 12 |
MS Office 2007. Integer value is 12.
|
Office2010 | 14 |
MS Office 2010. Integer value is 14.
|
Office2013 | 15 |
MS Office 2013. Integer value is 15.
|
Office2016Or2019 | 16 |
MS Office 2016/2019. Integer value is 16.
|
Remarks
The property is filled after the invoking of InitWord() method.
Example How to convert a PDF file to a RTF file in C#
using System;
using System.IO;
using System.Collections;
using SautinSoft;
namespace Sample
{
class Test
{
static void Main(string[] args)
{
SautinSoft.UseOffice u = new SautinSoft.UseOffice();
string inpFile = Path.GetFullPath(@"..\..\..\..\..\..\TestFiles\example.pdf");
string outFile = Path.GetFullPath("Result.rtf");
if (u.InitWord() != 0)
{
Console.WriteLine("Error: Can't load MS Word in memory!");
Console.WriteLine("Please contact SautinSoft's support Team: support@sautinsoft.com.");
Console.ReadLine();
}
if (u.OfficeVersion >= UseOffice.eOfficeVersion.Office2013)
{
int result = u.ConvertFile(inpFile, outFile, UseOffice.eDirection.PDF_to_RTF);
if (result == 0)
{
Console.WriteLine("Converting successfully!");
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true });
}
else
Console.WriteLine("Error! Please contact with SautinSoft support: support@sautinsoft.com.");
}
else
{
Console.WriteLine("To convert PDF documents, please install MS Office 2013 or higher.");
}
u.CloseOffice();
}
}
}
How to convert a PDF file to a RTF file in VB.Net
Imports System
Imports System.IO
Imports System.Collections
Imports SautinSoft
Namespace Sample
Friend Class Test
Shared Sub Main(ByVal args() As String)
Dim u As New SautinSoft.UseOffice()
Dim inpFile As String = Path.GetFullPath("..\..\..\..\..\..\TestFiles\example.pdf")
Dim outFile As String = Path.GetFullPath("Result.rtf")
If u.InitWord() <> 0 Then
Console.WriteLine("Error: Can't load MS Word in memory!")
Console.WriteLine("Please contact SautinSoft's support Team: support@sautinsoft.com.")
Console.ReadLine()
End If
If u.OfficeVersion >= UseOffice.eOfficeVersion.Office2013 Then
Dim result As Integer = u.ConvertFile(inpFile, outFile, UseOffice.eDirection.PDF_to_RTF)
If result = 0 Then
Console.WriteLine("Converting successfully!")
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With {.UseShellExecute = True})
Else
Console.WriteLine("Error! Please contact with SautinSoft support: support@sautinsoft.com.")
End If
Else
Console.WriteLine("To convert PDF documents, please install MS Office 2013 or higher.")
End If
u.CloseOffice()
End Sub
End Class
End Namespace
See Also