When we export data out from Database we may have requirements of exporting data from Datatable to CSV because CSV is a simple file format that is widely supported. CSV (The comma-separated values) file format is a set of file formats used to store tabular data in which numbers and text are stored in plain textual form that can be read in a text editor. Lines in the text file represent rows of a table, and commas in a line separate what are fields in the table row.

Here we mainly discuss how to Export Datatable to CSV with Spire.DataExport for .NET.

Download Spire.DataExport (or Spire.Office) with .NET Framework together. Only 2 Simple steps you can finish the whole datatable to CSV exporting process.

Step 1: Load Data Information

Before exporting data from DataTable, we should load data information from data source. And select which information we need export. Through DataGridVew, we even can preview and modify data information. So, in this step, our job is to prepare data which is about to be exported out.

[C#]
	
private void btnLoad_Click(object sender, EventArgs e)
{
  using (OleDbConnection oleDbConnection = new OleDbConnection())
  {
    oleDbConnection.ConnectionString = this.textBox1.Text;
    OleDbCommand oleDbCommand = new OleDbCommand();
    oleDbCommand.CommandText = this.textBox2.Text;
    oleDbCommand.Connection = oleDbConnection;
    using (OleDbDataAdapter da = new OleDbDataAdapter(oleDbCommand))
      {
      DataTable dt = new DataTable();
      da.Fill(dt);
       dataGridView1.DataSource = dt;
      }
  }
}

Effect Screenshot

Datatable to CSV

Step 2: Set Export into CSV

Spire.DataExport allows user to export data into most popular file formats including MS Excel, MS Word, HTML, PDF, XML, CSV, DBF, DIF, etc. Here we need set it as CSV format. Spire.DataExport will create a new CSV file and through DataGridView export data into CSV file. You also can rename the file as you like.

[C#]
private void btnRUN_Click(object sender, EventArgs e)
{
  TXTExport CSVExport = new TXTExport();
  CSVExport.DataSource = Spire.DataExport.Common.ExportSource.DataTable;
  CSVExport.DataTable = this.dataGridView1.DataSource as DataTable;
  CSVExport.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
  CSVExport.FileName = "CSV0721.csv";
  CSVExport.SaveToFile();
}

Effect Screenshot

Datatable to CSV

Thursday, 21 July 2011 03:51

Create Excel Bar Chart in C#, VB.NET

Why Create Excel Bar Chart?

For numerical comparisons, bar chart is a classic solution. Bar chart (graph) is a chart with rectangular bars with lengths proportional to the values that they represent. The bars can be plotted vertically or horizontally. A bar chart is very useful if you are trying to record certain information whether it is continuous or not continuous data. In bar charts, a class or group can have a single category of data, or they can be broken down further into multiple categories for greater depth of analysis. And in Microsoft Excel, it is the same useful!

How to Use C# to Create Excel Bar Chart?

Spire.XLS for .NET allows user to use C# create Excel bar chart. Use C# to create Excel bar chart could be as easy as in Microsoft Excel. The whole process is almost the same such as write chart data, set region/position of chart, Write chart title, chart data information, etc. The difference is we need fill these data in C# application with codes around. Below is a sample for C# code used to create Excel bar charts. Download Spire.XLS (or Spire.Office) with .NET framework 2.0 (or above) together and use the code to create Excel Bar Chart right now.

[C#]
using Spire.Xls;
using Spire.Xls.Charts;

namespace Spire.Xls.Sample
{
	class program
	{
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void btnRun_Click(object sender, System.EventArgs e)
		{
			Workbook workbook = new Workbook();
			
			//Initailize worksheet
			workbook.CreateEmptySheets(1);
			Worksheet sheet = workbook.Worksheets[0];
			sheet.Name = "Chart data";
			sheet.GridLinesVisible = false;

			//Writes chart data
			CreateChartData(sheet);
            //Add a new  chart worsheet to workbook
			Chart chart = sheet.Charts.Add();

			//Set region of chart data
			chart.DataRange = sheet.Range["A1:C5"];
			chart.SeriesDataFromRange = false;

			//Set position of chart
			chart.LeftColumn = 1;
			chart.TopRow = 6;
			chart.RightColumn = 11;
			chart.BottomRow = 29;


			if (checkBox1.Checked)
			{
				chart.ChartType =  ExcelChartType.Bar3DClustered;
			}
			else
			{
				chart.ChartType = ExcelChartType.BarClustered;
			}

            //Chart title
			chart.ChartTitle = "Sales market by country";
			chart.ChartTitleArea.IsBold = true;
			chart.ChartTitleArea.Size = 12;

			chart.PrimaryCategoryAxis.Title = "Country";
			chart.PrimaryCategoryAxis.Font.IsBold = true;
			chart.PrimaryCategoryAxis.TitleArea.IsBold = true;
			chart.PrimaryCategoryAxis.TitleArea.TextRotationAngle = 90;

			chart.PrimaryValueAxis.Title = "Sales(in Dollars)";
			chart.PrimaryValueAxis.HasMajorGridLines = false;
            chart.PrimaryValueAxis.MinValue = 1000;
			chart.PrimaryValueAxis.TitleArea.IsBold = true;


            foreach (Charts.ChartSerie cs in chart.Series)
            {
                cs.Format.Options.IsVaryColor = true;
                cs.DataPoints.DefaultDataPoint.DataLabels.HasValue = true;
            }

			chart.Legend.Position = LegendPositionType.Top;
			workbook.SaveToFile("Sample.xls",ExcelVersion.Version97to2003);
			ExcelDocViewer(workbook.FileName);
		}

		private void CreateChartData(Worksheet sheet)
		{
			//Country
			sheet.Range["A1"].Value = "Country";
			sheet.Range["A2"].Value = "Cuba";
			sheet.Range["A3"].Value = "Mexico";
			sheet.Range["A4"].Value = "France";
			sheet.Range["A5"].Value = "German";

			//Jun
			sheet.Range["B1"].Value = "Jun";
			sheet.Range["B2"].NumberValue = 6000;
			sheet.Range["B3"].NumberValue = 8000;
			sheet.Range["B4"].NumberValue = 9000;
			sheet.Range["B5"].NumberValue = 8500;

			//Jun
			sheet.Range["C1"].Value = "Aug";
			sheet.Range["C2"].NumberValue = 3000;
			sheet.Range["C3"].NumberValue = 2000;
			sheet.Range["C4"].NumberValue = 2300;
			sheet.Range["C5"].NumberValue = 4200;

			//Style
			sheet.Range["A1:C1"].Style.Font.IsBold = true;
			sheet.Range["A2:C2"].Style.KnownColor = ExcelColors.LightYellow;
			sheet.Range["A3:C3"].Style.KnownColor = ExcelColors.LightGreen1;
			sheet.Range["A4:C4"].Style.KnownColor = ExcelColors.LightOrange;
			sheet.Range["A5:C5"].Style.KnownColor = ExcelColors.LightTurquoise;

			//Border
			sheet.Range["A1:C5"].Style.Borders[BordersLineType.EdgeTop].Color = Color.FromArgb(0, 0, 128);
			sheet.Range["A1:C5"].Style.Borders[BordersLineType.EdgeTop].LineStyle = LineStyleType.Thin;
			sheet.Range["A1:C5"].Style.Borders[BordersLineType.EdgeBottom].Color = Color.FromArgb(0, 0, 128);
			sheet.Range["A1:C5"].Style.Borders[BordersLineType.EdgeBottom].LineStyle = LineStyleType.Thin;
			sheet.Range["A1:C5"].Style.Borders[BordersLineType.EdgeLeft].Color = Color.FromArgb(0, 0, 128);
			sheet.Range["A1:C5"].Style.Borders[BordersLineType.EdgeLeft].LineStyle = LineStyleType.Thin;
			sheet.Range["A1:C5"].Style.Borders[BordersLineType.EdgeRight].Color = Color.FromArgb(0, 0, 128);
			sheet.Range["A1:C5"].Style.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;

			sheet.Range["B2:C5"].Style.NumberFormat = "\"$\"#,##0";
		}

		private void ExcelDocViewer( string fileName )
		{
			try
			{
				System.Diagnostics.Process.Start(fileName);
			}
			catch{}
		}

		private void btnAbout_Click(object sender, System.EventArgs e)
		{
			Close();
		}
	}
}

After running your application with the code above, you will find an Excel bar Chart created.

Generate Excel Bar Chart

DBF is a format created by Ashton-Tate and can be recognized by ACT, Lipper, FoxPro, Arago, Wordtech, Xbase and other programs related with Database. Although MS Excel has been the most popular data form software application, DBF format data form files still used widely. So sometimes we may have requirements to export data from datatable to DBF. And with Spire.DataExport, we can export datatable to DBF through DataGridView effortlessly!

Download Spire.DataExport (or Spire.Office) with .NET Framework together. Only 2 Simple steps you can finish the whole datatable to DBF exporting process.

Step 1: Load Data Information

Before exporting data from DataTable, we should load data information from data source. And select which information we need export. Through DataGridVew, we even can preview and modify data information. So, in this step, our job is to prepare data which are about to be exported out.

[C#]
	
        private void btnLoad_Click(object sender, EventArgs e)
        {
            using (OleDbConnection oleDbConnection = new OleDbConnection())
            {
                oleDbConnection.ConnectionString = this.textBox1.Text;
                OleDbCommand oleDbCommand = new OleDbCommand();
                oleDbCommand.CommandText = this.textBox2.Text;
                oleDbCommand.Connection = oleDbConnection;
                using (OleDbDataAdapter da = new OleDbDataAdapter(oleDbCommand))
                {
                    DataTable dt = new DataTable();
                    da.Fill(dt);
                    dataGridView1.DataSource = dt;
                }
            }
        }

Effect Screenshot

Datatable to DBF

Step 2: Set Export into DBF

Spire.DataExport allows user to export data into most popular file formats including MS Excel, MS Word, HTML, PDF, XML, CSV, DBF, DIF, etc. Here we need set it as DBF format. Spire.DataExport will create a new DBF file and through DataGridView export data into DBF file. You also can rename the file as you like.

[C#]
        private void btnRun_Click(object sender, EventArgs e)
        {
            Spire.DataExport.DBF.DBFExport DBFExport = new Spire.DataExport.DBF.DBFExport();
            DBFExport.DataSource = Spire.DataExport.Common.ExportSource.DataTable;
            DBFExport.DataTable = this.dataGridView1.DataSource as DataTable;
            DBFExport.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
            DBFExport.FileName = "DBF0401.dbf";
            DBFExport.SaveToFile();
        }
          

Effect Screenshot

Datatable to DBF

Wednesday, 20 July 2011 05:44

How to Export DataTable to PDF

This article will show you how to use Spire.DataExport to Export Datatable to PDF through DataGridView. Through DataGridView, users can preview data information and modify the information if they think it’s not correct before exporting data. With Spire.DataExport, this whole exporting process could be fast and easy.

Download Spire.DataExport (or Spire.Office) with .NET Framework together. Only 2 Simple steps you can finish the whole datatable to PDF exporting process.

Step 1: Load Data Information

Before exporting data from DataTable, we should load data information from data source. And select which information we need export. Through DataGridVew, we even can preview and modify data information. So, in this step, our job is to prepare data which is about to be exported out.

[C#]
	
        private void btnLoad_Click(object sender, EventArgs e)
        {
            using (OleDbConnection oleDbConnection = new OleDbConnection())
            {
                oleDbConnection.ConnectionString = this.tbCS.Text;
                OleDbCommand oleDbCommand = new OleDbCommand();
                oleDbCommand.CommandText = this.tbCT.Text;
                oleDbCommand.Connection = oleDbConnection;
                using (OleDbDataAdapter da = new OleDbDataAdapter(oleDbCommand))
                {
                    DataTable dt = new DataTable();
                    da.Fill(dt);
                    dataGridView.DataSource = dt;
                }
            }
        }
   

Effect Screenshot

Datatable to PDF

Step 2: Set Export into PDF

Spire.DataExport allows user to export data into most popular file formats including MS Excel, MS Word, HTML, PDF, XML, CSV, DBF, DIF, etc. Here we need set it as PDF format. Spire.DataExport will create a new PDF file and through DataGridView export data into PDF file. You also can rename the file as you like.

[C#]
        private void btnRun_Click(object sender, EventArgs e)
        {
            Spire.DataExport.PDF.PDFExport PDFExport = new Spire.DataExport.PDF.PDFExport();
            PDFExport.DataSource = Spire.DataExport.Common.ExportSource.DataTable;
            PDFExport.DataTable = this.dataGridView.DataSource as DataTable;
            PDFExport.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
            PDFExport.SaveToFile("20110223.pdf");

        }

Effect Screenshot

Datatable to PDF

This section just aims at introducing an easiest solution to convert Excel (XLS/XLSX) to CSV with C#, VB.NET via an Excel component. Two reasons can be attributed to call this solution the easiest: One is that the key code of Excel to CSV is only three lines; the other reason is that you can directly convert Excel to CSV without opening the original Excel file.

Spire.XLS for .NET, as a .NET Excel component, enables users to fast create, read, write and modify Excel document without Microsoft Office Excel Automation. Besides, it has powerful conversion functions, such as it can easily convert excel to PDF, Excel to HTML, Excel to XML, XML to Excel, Excel to Image and Excel to CSV.

By calling a class Spire.XLS.Worksheet in Spire.XLS.dll component, you can convert Excel to CSV by calling a method: public void SaveToFile(string fileName, string separator, Encoding encoding) with three parameters passed. Please preview the effective screenshot of this task first:

Excel to CSV

Now before view the whole code of Excel to CSV conversion, please Download Spire.XLS for .NET.

Sample Code:

[C#]
using Spire.Xls;
namespace xls2csv
{
    class Program
    {
        static void Main(string[] args)
        {
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(@"..\ExceltoCSV.xls");
            Worksheet sheet = workbook.Worksheets[0];
            sheet.SaveToFile("sample.csv", ",", Encoding.UTF8);
        }
    }
}
[VB.NET]
Imports Spire.Xls
Namespace xls2csv
       Friend Class Program
              Shared Sub Main(ByVal args() As String)
                     Dim workbook As New Workbook()
                     workbook.LoadFromFile("..\ExceltoCSV.xls ")
                     Dim sheet As Worksheet = workbook.Worksheets(0)
                     sheet.SaveToFile("sample.csv", ",", Encoding.UTF8)
              End Sub
       End Class
End Namespace
Tuesday, 19 July 2011 07:19

Worksheet to Image in C#, VB.NET

Making a Microsoft Excel worksheet to an image file can be quite useful when you might need to use an image of a worksheet in an application or web page. This can be the most effective solution for developers to convert worksheet to image as this solution converts Excel spreadsheets-including all text, formatting and diagrams-to graphic files.

Spire.XLS for .NET supports converting Excel worksheets to images. To use this feature, you need to invocate the method - public void SaveToImage(string fileName) in your program or project. You can convert a worksheet to image file(s) with different attributes or options and you can save the image file to disk. Most image formats are supported, such as BMP, PNG, GIF, JPG, JPEG, TIFF, and etc.

  • Create a new workbook
  • Load information from excel file and transfer into workbook
  • Save workbook as any image file format at your will

Below is an effective screenshot of the target . png image from Excel spreadsheet.

Excel to Image

Download Spire.XLS for .NET (or Spire.Office) with .NET Framework 2.0 (or above) together. In your application add Spire.XLS reference. The following code snippet shows how to convert an Excel worksheet to an image in C#, VB.NET.

[C#]
using Spire.Xls;
namespace Xls2Image

{
    class Program
    {
        static void Main(string[] args)
        {
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(@"..\..\test.xls");
            Worksheet sheet = workbook.Worksheets[0];
            sheet.SaveToImage("sample.jpg");
        }
    }
}
[VB.NET]
Imports Spire.Xls
Namespace Xls2Image
       Friend Class Program
              Shared Sub Main(ByVal args() As String)
                     Dim workbook As New Workbook()
                     workbook.LoadFromFile("..\..\test.xls")
                     Dim sheet As Worksheet = workbook.Worksheets(0)
                     sheet.SaveToImage("sample.jpg")
              End Sub
       End Class
End Namespace

How can we export Excel to Office Open XML and import Office Open XML to Excel quickly and with sound quality? The answer is what most developers desire to know and clients concern. Here will demonstrate an effortless method to export Excel to Office Open XML and import Office Open XML to Excel separately or synchronously.

Spire.XLS for .NET is a professional .NET Excel component which enables us to fast export Excel to Office Open XML or import Office Open XML to Excel within just three steps. The export/import features such unique as below:

  • Microsoft Excel is not necessary on client and/or server side.
  • Export/import can be proceeding separately or synchronously.

Excel to XML

Spire.Xls for .NET always welcomes any kind of trial or evaluation, so feel free to download Spire.XLS for .NET to realize transform between Excel and Office Open XML within 3 steps.

PS: Spire.Xls only supports Office OpenXML.

Export Excel to Office Open XML in C#, VB.NET

The whole process of exporting Excel to Office Open XML in C#, VB.NET can be described as 3 simple steps:

  • Create a new workbook
  • Load information from excel file and transfer into workbook
  • Save workbook as Office Open XML file format

The following is the code sample that we use to export Excel to Office Open XML in C#, VB.NET

[C#]
Workbook wb = new Workbook();
wb.LoadFromFile(@"..\..\sample.xlsx");
wb.SaveAsXml("result.xml");
[VB.NET]
Dim wb As New Workbook()
wb.LoadFromFile(@"..\..\sample.xlsx")
wb.SaveAsXml("result.xml")

Import Office Open XML to Excel in C#, VB.NET

In this section, you will feel it is as easy as ABC to import Office Open XML to Excel in C#, VB.NET. This process will also be completed in 3 steps too. Please see the codes below:

[C#]
Workbook workbook = new Workbook();
workbook.LoadFromXml(@"..\..\test.xml");
workbook.SaveToFile("result.xlsx",ExcelVersion.Version2010);
[VB.NET]
Dim workbook As New Workbook()
workbook.LoadFromXml("..\..\test.xml")
workbook.SaveToFile("result.xlsx",ExcelVersion.Version2010)
Tuesday, 19 July 2011 03:26

Excel to HTML in C#, VB.NET

This article describes a simple approach to convert Excel to HTML by using C#/VB.NET. We will use as few codes as you can image to convert Excel to HTML in C#/VB.NET, with the perfect quality as you expect. The appearance of data can be improved as you can edit the HTML by applying personal CSS. Thus we believe any effect and requirement you or your clients wished to have.

Spire.XLS for .NET provides a well-designed class-workbook, which allows us to create new Excel or load an Excel in, and then we can convert Excel to HTML; meanwhile most optimization on the Excel is also allowed during the conversion. Spire.Xls for .NET is always welcome to any kind of trial and evaluation. So now please feel free to download Spire.XLS for .NET and then follow our guide to quickly convert Excel to HTML using C#/VB.NET or try other function of Spire.Xls for .NET.

Now please check my code samples for converting Excel to HTML in C#/VB.NET.

[C#]
using Spire.Xls;
namespace Xls2Html

{
    class Program
    {
        static void Main(string[] args)
        {
            //load Excel file
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(@"..\..\test.xls");
            
            //convert Excel to HTML
            Worksheet sheet = workbook.Worksheets[0];
            sheet.SaveToHtml("sample.html");

            //Preview HTML
            System.Diagnostics.Process.Start("sample.html");
        }
    }
}
[VB.NET]
Imports Spire.Xls
Namespace Xls2Html

	Class Program
		Private Shared Sub Main(args As String())
			'load Excel file
			Dim workbook As New Workbook()
			workbook.LoadFromFile("..\..\test.xls")

			'convert Excel to HTML
			Dim sheet As Worksheet = workbook.Worksheets(0)
			sheet.SaveToHtml("sample.html")

			'Preview HTML
			System.Diagnostics.Process.Start("sample.html")
		End Sub
	End Class
End Namespace

Now we can run this application and then a perfect HTML will be presented in your browser. Please see our effective screenshot as below:

Excel to HTML

Spire.DataExport supports exporting data from DataTable into HTML. HTML (HyperText Markup Language) is a language for describing web pages. HTML documents are also called web pages which contain HTML tags and plain text. Use Spire.DataExport exporting DataTable to HTML to share your data on internet.

Download Spire.DataExport (or Spire.Office) with .NET Framework together. Only 2 Simple steps you can finish the whole datatable to HTML exporting process.

Step 1: Load Data Information

Before exporting data from DataTable, we should load data information from data source. And select which information we need export. Through DataGridVew, we even can preview and modify data information. So, in this step, our job is to prepare data which are about to be exported out.

[C#]
	
        private void btnLoad_Click(object sender, EventArgs e)
        {
            using (OleDbConnection oleDbConnection = new OleDbConnection())
            {
                oleDbConnection.ConnectionString = this.tbCS.Text;
                System.Data.OleDb.OleDbCommand oleDbCommand = new OleDbCommand();
                oleDbCommand.CommandText = this.tbCT.Text;
                oleDbCommand.Connection = oleDbConnection;
                using (OleDbDataAdapter da = new OleDbDataAdapter(oleDbCommand))
                {
                    DataTable dt = new DataTable();
                    da.Fill(dt);
                    dataGridView1.DataSource = dt;
                }
            }
        }
   

Effect Screenshot

DataTable to HTML

Step 2: Set Export into HTML

Spire.DataExport allows user to export data into most popular file formats including MS Excel, MS Word, HTML, PDF, XML, CSV, DBF, DIF, etc. Here we need set it as HTML format. Spire.DataExport will create a new HTML file and through DataGridView export data into HTML file. You also can rename the file as you like.

[C#]
        private void btnRun_Click(object sender, EventArgs e)
        {
            Spire.DataExport.HTML.HTMLExport HTMLExport = new Spire.DataExport.HTML.HTMLExport();
            HTMLExport.DataSource = Spire.DataExport.Common.ExportSource.DataTable;
            HTMLExport.DataTable = this.dataGridView1.DataSource as DataTable;
            HTMLExport.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
            HTMLExport.SaveToFile("20110223.html");
        }  

Effect Screenshot

DataTable to HTML

Monday, 18 July 2011 05:40

How to Convert Word to RTF

Why Convert Word to RTF?

Since 1990s, Microsoft began to use .doc extension for a range of their proprietary word processing formats. Doc format is usually associated with Microsoft Office applications. But storing text in Doc files is not always convenient, as they are not compatible with the majority of third-party text editors. To make Doc information more accessible, it is better to store it in other, more common format. And as a rule, users select RTF format, because it is supported by the wide range of applications.

How to Convert Word to RTF with Spire.Doc?

Spire.Doc can convert Word to RTF without Microsoft Office installed on your system. Download Spire.Doc (or Spire.Office) with .NET Framework 2.0 (or above) and follow the simple steps below to convert Word to RTF.

Step 1: Create a project through Visual Studio and add Spire.Doc DLL as reference.

Step 2: Load local Word doc file which we need to convert to RTF format. Use the code below to load Word file.

            Document document = new Document();
            document.LoadFromFile(@"D:\Sample.doc");

Step 3: Spire.Doc allows users to convert Word doc files to most of popular file formats including PDF, HTML, RTF, EPub, XML, Dot, Text, etc. The following code can help us convert Word to RTF.

document.SaveToFile("Sample.rtf", FileFormat.Rtf);

Step 4: Copy the full code below into the project and start the project by pressing F5.

Full Code:

[C#]
	private void button1_Click(object sender, EventArgs e)
	{
	    //Create word document
	    Document document = new Document();
	    document.LoadFromFile(@"D:\Sample.doc");

	    //Save doc file.
	    document.SaveToFile("Sample.rtf", FileFormat.Rtf);

	    //Launching the MS Word file.
	    WordDocViewer("Sample.rtf");
	}

	private void WordDocViewer(string fileName)
	{
	    try
	    {
	        System.Diagnostics.Process.Start(fileName);
	    }
	    catch { }
	}
   
[VB.NET]
	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("D:\Sample.doc")

	    'Save doc file.
	    document_Renamed.SaveToFile("Sample.rtf", FileFormat.Rtf)

	    'Launching the MS Word file.
	    WordDocViewer("Sample.rtf")
	End Sub

	Private Sub WordDocViewer(ByVal fileName As String)
	    Try
	        Process.Start(fileName)
	    Catch
	    End Try
	End Sub        

Effective Screenshot:

Word to RTF

Page 113 of 116