473,394 Members | 1,748 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,394 software developers and data experts.

Using Word

Ken
I'm building an app that uses MS Word. I'm developing it on 2 machines,
one with Office XP, the other with Office 2003. I found that one of the
methods (SaveAs) has changed signatures between the versions. In this
case there is an additional, optional calling parameter at the end of
the list. What is a (the best) technique in C# to solve this problem?

Ken

Nov 17 '05 #1
8 1783
If the additional parameter is optional, then you wont have to supply it and
therefore the same call to the SAVEAS function should work in both
environments (or am I missing something?)

"Ken" wrote:
I'm building an app that uses MS Word. I'm developing it on 2 machines,
one with Office XP, the other with Office 2003. I found that one of the
methods (SaveAs) has changed signatures between the versions. In this
case there is an additional, optional calling parameter at the end of
the list. What is a (the best) technique in C# to solve this problem?

Ken

Nov 17 '05 #2
If the additional parameter is optional, then you wont have to supply it and
therefore the same call to the SAVEAS function should work in both
environments (or am I missing something?)

"Ken" wrote:
I'm building an app that uses MS Word. I'm developing it on 2 machines,
one with Office XP, the other with Office 2003. I found that one of the
methods (SaveAs) has changed signatures between the versions. In this
case there is an additional, optional calling parameter at the end of
the list. What is a (the best) technique in C# to solve this problem?

Ken

Nov 17 '05 #3
In C# you have to provide ALL calling parameters. To invoke the Word
method from C#, you must
1) type all parameters as object
2) pass them by ref
3) assign the value Type.Missing to any that you really aren't
providing.
Ken

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #4
In C# you have to provide ALL calling parameters. To invoke the Word
method from C#, you must
1) type all parameters as object
2) pass them by ref
3) assign the value Type.Missing to any that you really aren't
providing.
Ken

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #5

Unless the optional parameter is occationally required for some reason...?

Then you would probably do something like

if(word ver == allowsOptional) && (optionalValue != null)
callFuncWithOptParm(value1, ..valueN, optionalValue);
else
callFuncNoOptParm(value1, ..valueN);

that..?

Hope that helps..

- Andrew
Nov 17 '05 #6

Unless the optional parameter is occationally required for some reason...?

Then you would probably do something like

if(word ver == allowsOptional) && (optionalValue != null)
callFuncWithOptParm(value1, ..valueN, optionalValue);
else
callFuncNoOptParm(value1, ..valueN);

that..?

Hope that helps..

- Andrew
Nov 17 '05 #7
Ken
I looked in the object browser for Word.document for 2003. There are
two SaveAs methods: SaveAs (for 2003) and SaveAs2002. So I think I can
make something like your solution work.

Thanks.

Nov 17 '05 #8
Ken
I looked in the object browser for Word.document for 2003. There are
two SaveAs methods: SaveAs (for 2003) and SaveAs2002. So I think I can
make something like your solution work.

Thanks.

Nov 17 '05 #9

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

Similar topics

2
by: Martin Lucas-Smith | last post by:
I am trying to use PHP's COM support to open a URL from within MS Word then save the document. I am using PHP5.0.3/Apache2/WindowsXP. phpinfo() confirms that COM support is enabled. ...
2
by: Kathryn Prpic | last post by:
I created an mdb database for addresses, and now am having trouble using it. I don't have Access. I have Windows XP and am using Word. I want to import the database into Word so that I can...
7
by: Zeke | last post by:
I'm using the following code to create word document but the problem is if you go to task manager you'll see a WINWORD.EXE process is running but not the application, here is the code: ...
1
by: j | last post by:
Hi, I've been trying to do line/character counts on documents that are being uploaded. As well as the "counting" I also have to remove certain sections from the file. So, firstly I was working...
9
by: Nathan Sokalski | last post by:
I am trying to do a database search using LIKE using the following code: Private Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click If...
2
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
2
by: jordanp | last post by:
Hello, I'm having a little trouble here and I'm hoping that somebody might be able to help me out (win32 console program). First off, I know that I can use class function inside of my struct as...
5
by: Dave | last post by:
I need to filter an Access 2000 result set in ASP 30 using the ADO recordset.filter. I build the filter in pieces. The first clause of the filter is this... WHERE word LIKE 'S%' ... to...
6
by: Sajeena | last post by:
<?php // starting word $text = "My Text"; //Start MS Word $Word = new COM("word.application") or die("Failure: Word did not start"); echo("WORD has started."); //Formating the Font...
0
by: dbsog7777 | last post by:
I was trying to use the sample code below, but I encountered two errors: Application.DoEvents() and AutoText(entry). I am not sure how to correct the errors. I trying to use the sample code to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.