Total members 10249 | Gratitudes |It is currently Thu May 17, 2012 9:46 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Question
 Question subject: C# Word Styling Automation
PostPosted: Wed Apr 15, 2009 11:06 am 
Offline
Newbie
User avatar

Joined: Wed Apr 15, 2009 11:01 am
Posts: 1
Has thanked: 0 time
Have thanks: 0 time

Dear All,

Using C# and word object model, i am automate the process, where based on the tag name present in the document its corresponding style has to be applied for the paragraph.
For instance:
<H1>This is Heading1
<Para>This is Paragraph sample...

Our task is to find the <H1> tag and replace it with "H1" style for the whole document.

Below is the code where I can open the document and add the template styles into the current file.

Code:
ApplicationClass objWordApp = new ApplicationClass();
Document objWordDoc = new Document();         

foreach (string eachfile in lstfile.Items)
{
                Object nothing = System.Reflection.Missing.Value;
                Object fileName = txtFilename.Text.ToString();
                Object notTrue = false; 
                Object missing = System.Reflection.Missing.Value;
                objWordDoc = null;

                Object readOnly = false;
                Object isVisible = false;

                objWordApp.Visible = false;

                objWordDoc = objWordApp.Documents.Open(ref fileName, ref

missing,
                      ref readOnly, ref missing, ref missing, ref missing,
                      ref missing, ref missing, ref missing, ref missing,
                      ref missing, ref isVisible, ref missing, ref missing,
                      ref missing, ref missing);
                objWordDoc.Activate();
                objWordApp.Visible = false;

                string InDoc = OPagPath + "\\" + eachfile;
                objWordApp.Selection.InsertFile(PagFpath, ref missing, ref missing, ref

missing, ref missing);

   //Here I need help to find and replace with particular style
}

objWordApp.Quit(ref notTrue, ref missing, ref missing);


I need your help/suggestion to find text and replace with corresponding style.

Thanks,
Rangesh


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  

 Similar topics
 Change the word spacing in paragraph
 java code to open word doc attached in ms access.db
 convert word, Excel to PDF
 Word & ASP.Net ISSUE
 Jobs-130747-Automation Tester in Bangalore, Hyderabad
 Simple Word Program
 word counts in php

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team