Category Archives: Office

Examine the unique words in a Microsoft Word file in C#

This example is a modification of the earlier post List the unique words in a Microsoft Word file in C#. That program reads the words in a Microsoft word file, sorts them, and then displays the unique words in a … Continue reading

Posted in files, Office, strings, Word | Tagged , , , , , , , , , , , , , | Leave a comment

Save several images into Access in C#

The example Save images in an Access database in C# includes an Access database. Unfortunately if you save several images into the database and then open the database in Access, Access removes the images. It just doesn’t seem to understand … Continue reading

Posted in database, graphics, image processing, Office | Tagged , , , , , , , , , , , , , , , , , , | 1 Comment

Load images from an Access database in C#

The post Save images in an Access database in C# explains how to save images in an Access database. This post explains how to load images from an Access display them. Like previous examples, this program uses a SQL statement … Continue reading

Posted in database, graphics, image processing, Office | Tagged , , , , , , , , , , , , , , , , , | 2 Comments

Save images in an Access database in C#

This example shows how you can save images in an Access database. The example Use filenames stored in a database to display images in C# shows how to display images by saving the image file names in a database and … Continue reading

Posted in database, graphics, image processing, Office | Tagged , , , , , , , , , , , , , , , , , | 4 Comments

Convert RTF and TXT files into DOCX files in C#

First add a reference to Microsoft.Office.Interop.Word. To make using the library easier, add this using statement: using Word = Microsoft.Office.Interop.Word; When you enter the input and output file names and click Convert, the program uses the following code to open … Continue reading

Posted in files, interoperability, Office, Word | Tagged , , , , , , , , , , , , , | Leave a comment

Convert doc files into docx files in C#

This example shows how to write a C# program to automatically convert doc files into docx files. In a previous version of Windows, whenever I double-clicked a .doc file, I got this error message: Error The operating system is not … Continue reading

Posted in Office, Word | Tagged , , , , , , , , , , , , | Leave a comment

Load a CSV file in Excel in C#

Loading a CSV file (comma-separated value file) into Excel isn’t too hard once you know the tricks. Using the same tricks you can load a file that uses any delimiter, not just a comma. First at design time, add a … Continue reading

Posted in Excel, files, Office | Tagged , , , , , , , , , , , , | 5 Comments

Make an Excel chart in C#

This example uses the following code to create an Excel chart in a new workbook. private void btnCreateChart_Click( object sender, EventArgs e) { // Get the Excel application object. Excel.Application excel_app = new Excel.ApplicationClass(); // Make Excel visible (optional). excel_app.Visible … Continue reading

Posted in Excel, interoperability, Office | Tagged , , , , , , , , , , | Leave a comment

Add and remove pictures in an Excel worksheet

This is another brief foray into VBA programming. When you click the Insert Image button, the following VBA code executes. ‘ Insert a picture at the selection. Sub Button1_Click() Dim filters As String Dim filename As Variant ‘ Define the … Continue reading

Posted in Excel, Office, VBA | Tagged , , , , , , , , , | Leave a comment

Save images in an Access database in WPF and C#

The example Display images in an Access database in WPF and C# shows how you can display images saved in an Access database. Of course that begs the question, “How do you save images in the database in the first … Continue reading

Posted in database, graphics, image processing, Office | Tagged , , , , , , , , , , , , , , , | Leave a comment