Hi,
I use this program to sort the images in word document. in this i try to get the input as MS Word document.
while compiling it ends with namespace error - using System;
-
using System.Collections;
-
using System.Collections.Generic;
-
using Word = Microsoft.Office.Interop.Word;
-
-
namespace WindowsFormsApplication1
-
{
-
class WindowsFormsApplication1
-
{
-
#region Constructor
-
public WindowsFormsApplication1()
-
{
-
WordApp = new Microsoft.Office.Interop.Word.Application();
-
}
-
#endregion
-
-
#region Fields
-
private Word.Application WordApp;
-
private object missing = System.Reflection.Missing.Value;
-
private object yes = true;
-
private object no = false;
-
private Word.Document d;
-
private object filename = @"C:\Data\example.doc";
-
#endregion
-
-
#region Methods
-
public void UpdateDoc()
-
{
-
d = WordApp.Documents.Open(ref filename, ref missing, ref no, ref missing,
-
ref missing, ref missing, ref missing, ref missing, ref missing,
-
ref missing, ref missing, ref yes, ref missing, ref missing, ref missing, ref missing);
-
List<Word.Range> ranges = new List<Microsoft.Office.Interop.Word.Range>();
-
foreach (Word.InlineShape s in d.InlineShapes)
-
{
-
if (s.Type == Microsoft.Office.Interop.Word.WdInlineShapeType.wdInlineShapePicture)
-
{
-
ranges.Add(s.Range);
-
s.Delete();
-
}
-
}
-
foreach (Word.Range r in ranges)
-
{
-
r.InlineShapes.AddPicture(@"C:\Photo\Image.jpg", ref missing, ref missing, ref missing);
-
}
-
WordApp.Quit(ref yes, ref missing, ref missing);
-
}
-
#endregion
-
}
-
}
How to resolve this?
3 3519
I see this got answered in your msdn version of the question, though that problem is not replicated here as you have the correct capitalising on word, though ironically that may have been the spell checker in the code poster that made you update it, fixing your code for you.
dont use Microsoft.Office.Interop.Word,
use Open XML SDK 2.0
I suggest using Microsoft.Office.Interop.Word as then you're using something native in the language/framework.
What is the exact error you're getting?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: bracoute |
last post by:
Hello....
can you plz help me ... i'm using vbscript in asp.net and
i've referenced the microsoft.office.interop.word.dll so
that i can use the wordApplication object to automate MS
Word.. the...
|
by: R Reyes |
last post by:
ISSUE (reposted)
===========================
Can someone please explain to me why I can't get the MS Word Interop assembly
to work in my VS2005 project? For many people, they say they add the...
|
by: Alan T |
last post by:
VS 2005 and MS Office 2003 installed.
I can include Microsoft.Office.Core and Word in the references so I can add
the
using Microsoft.Office.Interop.Word.
However, my workmate cannot do the...
|
by: sajithkahawatta |
last post by:
my web page C#.net is work properly in my iis .but when i publish in another server it give errers.i used vs2005 and ms word 2003.
but in the server there is no vs2005 or word installed. it has only...
|
by: chovatia.jaydeep |
last post by:
Hi,
I want to hide Menubar/Toolbar in Word/Excel 2007. I followed steps
given in the link: http://msdn2.microsoft.com/en-us/library/aa338202.aspx
Following above linke, i created Add-In...
|
by: kalyanilovesme |
last post by:
how to import that name space(Microsoft.Office.Interop.Word) in asp.net with c#..
i added the reference of microsoft.office11.0.object library
even though this name space not coming...
|
by: mac73 |
last post by:
Hi,
I am using asp.net 2.0 application with Microsoft.Office.Interop.Word version 11.0.0.0 on windows server 2003 with IIS 6.0. It works fine with access given to Network service.
The scenario...
|
by: PulkitZery |
last post by:
Hello!
I am looking to find Microsoft.Office.Interop.Word dll for Office 2007, to include it into my project’s bin folder. I tried to download it from :
...
|
by: jojee |
last post by:
Hi All i have a little problem in my project that is i m using word document for reading the contents from it so i did add the references Microsoft.Word.Object library and in the wen.config file i...
|
by: Alex Dransfield |
last post by:
I am trying to add text to a shape but I can't figure out how to do it.. I am using the method
public void DrawOnDoc(object oMissing, Microsoft.Office.Interop.Word._Document oDoc)
{
...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |