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

ASP.NET Microsoft.Office.Interop.Word--> IMAGE issue

1
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 is that i open Word document using Microsoft word's application class, insert text and save it.

Problem: Text insertion is fine. But when i save it and open it again, all the images that were in the original document are lost.

If i use interactive user as DCOM identity for word, than images work fine. But i cant use as interactive user. So what setting do i need so that images can be preserved.
Aug 16 '07 #1
1 4915
Imports Microsoft.Office.Interop.Word

Public Class Form1
Inherits System.Windows.Forms.Form
Dim WordApp As New Microsoft.Office.Interop.Word.Application


#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(112, 56)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim filename As Object = "C:\1.doc"

' Dim newdoc As Document = WordApp.Documents.Open(filename)
Dim nd As Document = WordApp.Documents.Open(filename)

Dim oBarcodeBookmark As Object = "bookmark1"

Dim save As Object = False

Dim destFile As Object = "C:\1.doc"

Dim range As Microsoft.Office.Interop.Word.Range

range = nd.Bookmarks.Item(oBarcodeBookmark).Range

range.Select()

WordApp.Selection.TypeParagraph()

Dim bi As Image = Image.FromFile("c:\ku.jpg")

Clipboard.SetDataObject(bi)

range.Paste()

range.Select()

WordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter

nd.SaveAs(destFile)

WordApp.Quit(save)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(WordApp)

bi.Dispose()

MessageBox.Show("successfully inserted image")

End Sub



End Class





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 is that i open Word document using Microsoft word's application class, insert text and save it.

Problem: Text insertion is fine. But when i save it and open it again, all the images that were in the original document are lost.

If i use interactive user as DCOM identity for word, than images work fine. But i cant use as interactive user. So what setting do i need so that images can be preserved.
Nov 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Stephen Noronha | last post by:
Hi, I am trying a sample app to send an email from my app I am getting a "type not defined error" I have added "Office and Outlook" COM component but still I am getting this error... Please...
2
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability,...
1
by: Tory Collum | last post by:
My code works as a VB.NET executable file. So I'm trying to "adapt" it to a ..NET XML Web Service. As a VB.NET file, I used Microsoft.Office.Core as the reference, and everything was fine, but...
1
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...
0
by: Dennis G | last post by:
Hi, When the asp.net page is loading, i want to open a visio file (2007), change the commandstring of a datarecordset in the visio file, export the visio file to an image file (.png) and show...
1
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...
2
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a...
3
OuTCasT
by: OuTCasT | last post by:
Hi I have created an asp.net project that exports items from datagridview to and outlook calendar This is the code that i have used.. Dim body As String Dim ends As String ...
0
by: Jason Hamilton | last post by:
Hey all, I have written a Windows Forms application in VB.NET that creates a WCF Server. This server uses the Microsoft.Office.Interop.Access library to get a list of all of the MS Access...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.