convert word files to plain text c#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Interop.Word;
namespace ReadWordDocProject
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string testFile = @"C:\Users\<mycomputer>\Documents\TestItemHelpers\TestWordDoc.docx";
Microsoft.Office.Interop.Word.Application application = new Microsoft.Office.Interop.Word.Application();
Document document = application.Documents.Open(testFile);//path here
int count = document.Words.Count;
for (int i = 1; i <= count; i++)
{
string text = document.Words[i].Text;
//Do output with text here
richTextBox1.AppendText(text);
}
((_Application)application).Quit(); //cast as _Application because there's ambiguity
}
}
}
Also in C#:
- how to display an image url in c# picturebox
- button commandfield commandargument pass textbox
- c# declare an int list
- get hash c#
- isprime c#
- unity making homing missile
- degree to radians c#
- change navigation bar of master detail page xamarin form
- how to flip selection in aseprite
- create a file in the directory of the exe and write to it c#
- texture to image unity
- c# object to json string
- 2d object look at object
- c# round to closest multiple
- how to detected WindowCloseEvent in other window wpf
- how to mock abstract httpcontext using moq .net core
- how to locate a specific element in a list c#
- c# clone stream
- dontdestroyonload unity
- when do i need to end a sentence with ; in c#
- top down movement unity
- unity rigid body variable
- attribute usage c#
- set decimal point c#