Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to pro grammatically remove a particular word or line from word document using c# ASP.NET?

AND also how to export all the data from one word document to another document in asp.net c#
Posted
Comments
Sergey Alexandrovich Kryukov 29-Sep-14 1:47am    
What have you tried so far?
—SA
Member 11071167 29-Sep-14 1:57am    
I just googled to find the solution but, it was very confusing ..I have no much experience in asp.net.
so far i have managed to open the document , insert logo.
The challenge is .. to search contact number from the candidates resume and delete it. and then copy whole data of the resume and paste it into another document .

1 solution

Use the following links fro reference:

VB
http://www.techrepublic.com/blog/howdoi/how-do-i-modify-word-documents-using-c/190[^]
http://www.c-sharpcorner.com/UploadFile/amrish_deep/WordAutomation05102007223934PM/WordAutomation.aspx
 
Share this answer
 
Comments
Member 11071167 9-Oct-14 2:53am    
Hi..
How to copy contents from one word document into another word doc pro grammatically using C# Asp.net?

Thanks
MukeshSagar 9-Oct-14 4:37am    
With the Microsoft.Office.Interop.Word assembly, we get the contents and formatting from the document.

Tip:
Add the Microsoft.Office.Interop.Word assembly to your project. Go to Project -> Add Reference...

To Read File:

using System;
using Microsoft.Office.Interop.Word;

class Program
{
static void Main()
{
// Open a doc file.
Application application = new Application();
Document document = application.Documents.Open("C:\\word.doc");

// Loop through all words in the document.
int count = document.Words.Count;
for (int i = 1; i <= count; i++)
{
// Write the word.
string text = document.Words[i].Text;
Console.WriteLine("Word {0} = {1}", i, text);
}
// Close word.
application.Quit();
}
}


To Write File:

var document = new DocumentModel();

// Add document content.
document.Sections.Add(
new Section(document,
new Paragraph(document, "Hello world!")));

// Save the document to a file.
document.Save("Document.docx");

// Open the document file with Microsoft Word.
Process.Start("Document.docx");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900