473,785 Members | 2,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Word Properties Automation

I´m trying to do some Word Automation in C# in the Custom Properties
so far found very few ways to do that

I made the following :
Type Prop = Type.GetTypeFro mProgID("Word.C ustopParopertie s");
System.Object obj = Activator.Creat eInstance(Prop) ;
Microsoft.Offic e.Interop.Word. CustomPropertie s CustomProp = obj as
Microsoft.Offic e.Interop.Word. CustomPropertie s;
foreach (Microsoft.Offi ce.Interop.Word .CustomProperty property in CustomProp)
{ if (property.Name == valfind) property.Value = valreplace; }

So far I´ve been getting the following error

System.Argument NullException: Value cannot be null.
Parameter name: type

Source Error:
Line 53:
Line 54: Type Prop =
Type.GetTypeFro mProgID("Word.C ustopParopertie s");
Line 55: System.Object obj = Activator.Creat eInstance(Prop) ;
Line 56:
Line 57: Microsoft.Offic e.Interop.Word. CustomPropertie s
CustomProp = obj as Microsoft.Offic e.Interop.Word. CustomPropertie s;

I understand I dont have the ProgID right but have no idea how to do this,
I´m quite new in C# and all
Even dont know if this is the best place for my question

Any help I´ll be thankful

Jun 27 '08 #1
0 954

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

Similar topics

3
2783
by: Emily John | last post by:
I have a word document that I need to send it as an attachment to an XML file. Basically, converting into byte array or using some encoding mechanism. This has to be done through XML serialization in c#. Is it possible to do it through xml serialization ? THanks, --Emily *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
12
5533
by: Cheval | last post by:
Has anyone had any problems with inter-office automation between MS Word and MS Access in Office 2003? I have recently installed office 2003 in a new folder and have left the older office 2000 and office XP components installed. ie I have word/access/excel 2k/xp/2003 installed. I tried to do a usual access 2k to word 2k automation yet I get the error "Automation Error" "ClassFactory cannot supply requested class" when on late binding try...
4
7684
by: Daniel | last post by:
Hello, i have a problem with the word automation from c#. First, i want to mention, that i don't have any dependencies from word in my c#-project, i want to use the system.reflection model to handle the automation. So, i'm using the following code to create a new word document: ---Code---
12
2985
by: Evan Stone | last post by:
If one is developing a .NET application, how can I develop an application that uses COM automation that targets multiple versions of Word? For example, the signature for the Document.Open method is different from version 9 to version 11 (and I'm sure there are other variations as well), and I'm wondering if there's some easy way to deal with it. At present I'm only concerned with supporting 9-11 (i.e. Word 2000, XP, and 2003), though I'd...
4
3970
by: Bill Coan | last post by:
NOTE: This was posted earlier to vsnet.vstools.office under a different subject line but received no response. I'm having a problem automating Word's Find object from a .NET application, using late binding. If I use early binding, my code runs fine on most systems, but it is vulnerable to a known bug explained here: http://support.microsoft.com/default.aspx?scid=kb;en-us;292744
3
5611
by: Charles Law | last post by:
Word has a property BuiltinDocumentProperties, which (in VBA) returns a DocumentProperties collection. In VB.NET, using Word automation, it returns a _ComObject. I have tried to cast this to DocumentProperties, but I get an invalid cast exception. In Explorer, I can right click a Word document, click Properties, and I get a tabbed dialog with Custom and Summary tabs. These tabs show me the built in document properties of the document. ...
2
4084
by: a.crowley | last post by:
I have a large set of Word documents that I wish to catalogue in an Access database. Each document has a set of file properties populated (title, subject, author, keywords, comments ect), so I'd like to import those into an Access table for processing. I've written VBS macros in the past to import data from Excel sheets into Access tables, but the same functionality does not appear to be available for Word. Any clues or sample code...
0
1160
by: Probi | last post by:
Hi, I´m trying to make word automation on document custom properties(for a given property name change the value) I put this code together: Type Prop = Type.GetTypeFromProgID("Word.CustopParoperties"); System.Object obj = Activator.CreateInstance(Prop); Microsoft.Office.Interop.Word.CustomProperties CustomProp = obj as Microsoft.Office.Interop.Word.CustomProperties;
0
1135
by: Tim Rowe | last post by:
2008/10/7 Peter Wang <peterwang@vip.qq.com>: Why use VBA? It's actually not a straight choice. VBA is pretty much all that's available if you're doing it from *inside* Word, it's not available if you're doing it from *outside* Word. VB is available from outside Word, but I for one would much sooner use Python in that case. The difficulty isn't with the language, it's with lack of
0
9645
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
10330
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
10153
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...
1
10093
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8976
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
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
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
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.