1
namespace WordDocument
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{ CreateDocument();
}
private void CreateDocument()
{
Microsoft.Office.Interop.Word.Application winword = new Microsoft.Office.Interop.Word.Application();
winword.Visible = true;
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Document document = winword.Documents.Add(ref missing, ref missing, ref missing, ref missing);
document.Content.SetRange(0, 0);
document.Content.Text = "SALE DEED OF THE IMMOVABLE PROPERTY BEING FLAT NO. " + textBox1.Text + " ON THE " + textBox2.Text + " Floor IN THE SCHEME KNOWN AS '" + textBox3.Text + "' FOR Rs. " + textBox4.Text + "-00. (Rs. " + textBox5.Text + " Only)." + Environment.NewLine;
document.Content.Font.Name = "Arial";
document.Content.Bold = 1;
document.Content.Font.Size = 13;
document.Content.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphJustify;
Microsoft.Office.Interop.Word.Paragraph para4 = document.Content.Paragraphs.Add(ref missing);
para4.Range.Text = " Resi at- " + textBox11.Text + " :Vadodara.";
para4.Range.Font.Name = "Arial";
para4.Range.Font.Size = 13;
para4.Range.Font.Bold = 0;
object objStart2 = para3.Range.Text.IndexOf("V");
object objEnd2 = para3.Range.Start + para3.Range.Text.IndexOf(".");
Microsoft.Office.Interop.Word.Range rngBold2 = document.Range(ref objStart2, ref objEnd2);
rngBold2.Bold = 1;
para4.Range.InsertParagraphAfter();