473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Double Spacing in an MS Word Document

Hey folks,

I'm creating an MS Word document in a C# Windows application. Because the
client base has so many different versions of Word they are using, I opted
to go with late binding to create the document.

**Everything works great, but I can't figure out how to do 2 things:
1) Double Spacing
2) Insert a Page Break

Here's some snippet of code to help you see how I am doing it (This creates
the document, makes it visible, sets the font size, sets it to bold, and
writes out some text):

Type WordType = Type.GetTypeFromProgID("Word.Application");

Object WordApp = Activator.CreateInstance(WordType);

WordType.InvokeMember("Visible", BindingFlags.SetProperty, null, WordApp,
new object[]{true});

Object WordDoc = WordApp.GetType().InvokeMember( "Documents",
BindingFlags.GetProperty, null, WordApp, null );

WordDoc = WordDoc.GetType().InvokeMember( "Add", BindingFlags.InvokeMethod,
null, WordDoc, null );

Object WordSelection = WordApp.GetType().InvokeMember( "Selection",
BindingFlags.GetProperty, null, WordApp, null );

Object WordFont = WordSelection.GetType().InvokeMember( "Font",
BindingFlags.GetProperty, null, WordSelection, null );

WordType.InvokeMember("Size", BindingFlags.SetProperty, null, WordFont, new
object[]{10});

WordType.InvokeMember("Bold", BindingFlags.SetProperty, null, WordFont, new
object[]{true});

WordType.InvokeMember("TypeText", BindingFlags.InvokeMethod, null,
WordSelection, new object[]{"MY WONDERFUL TEXT"});
Nov 16 '05 #1
0 1358

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrew Poulos | last post by:
I'm trying to build a table using DOM methods with script that follows this type of format: // note the var bodyEl is predefined as the body element // var mytable =...
12
by: Sebastien B. | last post by:
I'm wondering if it's at all possible to have spacing between a table's cells, and only between the cells, not between the outter cells and the table's border. See end of message for an example...
1
by: Prophet | last post by:
When using the following code, there is a space between the two items that are written.....how do I eliminate the space so that it is single spaced? document.write("<font size='3'><p...
38
by: Xah Lee | last post by:
sometimes i wish to add white space in <p> as to achived effects similar to tab. what should i do? using empty image seems the sure way but rather complicated. (and dosen't change size with...
3
by: DigMar | last post by:
Hello, Thi is a newbie question regarding the spacing of words in a header with links. I simply want to space the clickable words on my header bar more horizontally. Here is my code to make more...
5
by: maya | last post by:
hi, I'm having a problem with spacing betw. paragraphs, whether use <br>'s or <p>'s.. FF inserts so much more space betw. paragraphs than IE does <br><brshows up differently in FF from how it...
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
6
by: greynium | last post by:
hi Please see http://thatshindi.oneindia.in in Firefox and IE7. The spacing between the lines are different. What we see in Firefox is what we desire. How do we fix things to make it look...
5
by: Jukka K. Korpela | last post by:
ZZ wrote: You're upside-down fullquoting your own question. Sounds pretty hopeless, but being an optimist, I'm taking a look... Is there a reason to that?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.