473,790 Members | 3,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetTypeFro mProgID("Word.A pplication");

Object WordApp = Activator.Creat eInstance(WordT ype);

WordType.Invoke Member("Visible ", BindingFlags.Se tProperty, null, WordApp,
new object[]{true});

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

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

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

Object WordFont = WordSelection.G etType().Invoke Member( "Font",
BindingFlags.Ge tProperty, null, WordSelection, null );

WordType.Invoke Member("Size", BindingFlags.Se tProperty, null, WordFont, new
object[]{10});

WordType.Invoke Member("Bold", BindingFlags.Se tProperty, null, WordFont, new
object[]{true});

WordType.Invoke Member("TypeTex t", BindingFlags.In vokeMethod, null,
WordSelection, new object[]{"MY WONDERFUL TEXT"});
Nov 16 '05 #1
0 1381

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

Similar topics

1
1848
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 = document.createElement("TABLE"); var mytablebody = document.createElement("TBODY"); // First row var mycurrent_row = document.createElement("TR"); var mycurrent_cell = document.createElement("TD");
12
2220
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 (make sure to view this in fixed width font). I've played around with different things, such as margin-right, etc. but I didn't get any results. Would this be even possible. I would have thought the specs (either HTML or CSS) would have allowed...
1
1874
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 align='left'><i><font color='#0000FF'>"+adtitlearray+"</i>") document.write("<font size='2'><p align='left'><font color='#000000'><font face='Times New Roman'>"+adinfoarray+" "+"<a href = '" + adsitearray + " " + "'/> ...more")}
38
24009
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 font) Woudl some of the space character in unicode work? (my html files uses unicode) Xah
3
1561
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 sense: // HEADER MENU OPTIONS document.write('<span class="header">');
5
2402
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 shows up in IE.. I know it's better practice to use <pinstead of <br>'s, but FF inserts space ABOVE paragraph when you use <p>... any comments about this would be appreciated.. thank you..
116
36001
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 problems elsewhere in another part of the system where that figure was used for some calculation and some eventual truncation led to the system going haywire. So my question is, given this code: int main() { float f = 59.89F;
6
3810
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 right in IE7. To make things simpler we have uploaded only part of the text on http://images.oneindia.in/temp/spacing.html The space between the bullets in IE7 is more than what we want.
5
2030
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
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10201
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9023
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4100
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.