Wrox Programmer Forums
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 22nd, 2012, 06:45 AM
Authorized User
Join Date: May 2008
Posts: 31
Thanks: 6
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rangeshram
Thumbs up VBA CSS Creation


We need to process the word document and generate CSS file which used for ePub creation. Please give your thoughts for the two methods used to generate CSS.

Method 1: Process through WordML (my colleague suggestion)

Method 2
: Read character by characer and based on the Word Object Model generate CSS .

For example: margin-top: 1em will be set based on Word paragraph space before


border-bottom:5px solid #33339a;

Please tell about the pros and cons for the above two methods. And also specify which is the best and effective.

Note: We have also google and found that "http://www.oocities.org/w2css/" is helpful but can't able to download.

Old March 18th, 2013, 12:54 PM
Friend of Wrox
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts

Hi Ram

If the WordML provides the necessary styles nothing like it. Reading character by character is not viable; instead you can loop through the styles that are available in the document (Heading 1, FootNote, Figure etc .. ) and then create a stylesheet from that..

C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting CSS to center Monochrome CSS SamuelMSr BOOK: Beginning ASP.NET 4 : in C# and VB 2 September 20th, 2011 03:50 AM
CSS - editing the css style sheet doesn't take effect immediately sayo ASP.NET 3.5 Basics 6 March 13th, 2009 02:32 AM
CSS HELP:! CSS EXPANDIBLE BACKGROUND FOR TITLE phpuser2000 CSS Cascading Style Sheets 2 December 19th, 2007 12:36 AM
Rich's new CSS book: Beginning CSS 2nd Edition jminatel BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 0 June 15th, 2007 11:55 AM
error in word VBA to automate creation of mailing dgr7 Word VBA 1 April 4th, 2007 08:34 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.