i have problem in opening the word document , it shows an error like could not open macro storage, please help me , thanks in advance
7 72449
hi,
here is the code to open the word document.
add a COM reference to your project by right clicking in the solution explorer on References->Add Reference
Click on the COM tab and look for the Microsoft Word 9.0 Object Library
just declare the line below in your class: - private Word.ApplicationClass WordApp = new Word.ApplicationClass();
-
-
-
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
-
{
-
object fileName = openFileDialog1.FileName;
-
object readOnly = false;
-
-
object isVisible = true;
-
object missing = System.Reflection.Missing.Value;
-
WordApp.Visible = true;
-
-
Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing,ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);
-
-
aDoc.Activate();
-
-
}
regards,
Began.
I did every thing what u given code, but runtime it throws an error " Could not open macro storage "
hi,
here is the code to open the word document.
add a COM reference to your project by right clicking in the solution explorer on References->Add Reference
Click on the COM tab and look for the Microsoft Word 9.0 Object Library
just declare the line below in your class: -
private Word.ApplicationClass WordApp = new Word.ApplicationClass();
-
-
-
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
-
{
-
object fileName = openFileDialog1.FileName;
-
object readOnly = false;
-
-
object isVisible = true;
-
object missing = System.Reflection.Missing.Value;
-
WordApp.Visible = true;
-
-
Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing,ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);
-
-
aDoc.Activate();
-
-
}
regards,
Began.
I did every thing what u given code, but runtime it throws an error " Could not open macro storage "
Did you get to solve this issue? If you have I am very interested to know how you did it because it is driving me nuts. I have tried everything I could possibly find on the website and more. Help please if you can.
Hi,
the account running the web app (network service) needs access to the Word COM object
use dcomcnfg.msc
as you said the user account under which runs the asp.net don't have enough rights to call in execution the MS Word. One way is of course to use dcomconfig enable the asp.net but what if somebodey tries to hack you? you should use impersonation because is more safe.
when we try to open word document with the help of code given by you, it does not open the information in header and footer. please help how we can read header and footer of the document also.
when we try to open word document with the help of code given by you, it does not open the information in header and footer. please help how we can read header and footer of the document also.
-
if( Request.QueryString["strFile"] != null )
-
{
-
string strFilePath1="";
-
string strFileName = Request.QueryString["strFile"].ToString();
-
strFilePath1=Request.PhysicalApplicationPath+"/BackOffice/Catalogue/UploadFiles/"+strFileName;
-
if(strFileName!="")
-
{
-
Response.ContentType=strFilePath1;
-
Response.AddHeader("content-disposition", "attachment;filename="+strFileName);
-
Response.WriteFile(strFilePath1);
-
}
-
}
Regards,
R.Ganesan
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Vikas Kumar |
last post by:
how to open word document and pdf file in aspx page
|
by: Niyazi |
last post by:
Hi,
I created application that store the data in SQL SERVER that reside on
network. The client also use this application to access the resources
provided with application. But is the client want to register new customer or
companies they will enter the information in Windows Form and the program
automaticaly creates the WORD document under specific folder under
application path. Once the empty word file created than ask user if they want...
|
by: Alan T |
last post by:
In my C# application, I want to open a Word document using the code from the
Help:
using Microsoft.Office.Interop.Word;
object readOnly = true;
object fileName = @"C:\Test\NewDocument.doc";
this.Application.Documents.Open(ref fileName,
ref missing, ref readOnly, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
|
by: Antoine De Groote |
last post by:
Hi there,
I have a word document containing pictures and text. This documents
holds several 'ABCDEF' strings which serve as a placeholder for names.
Now I want to replace these occurences with names in a list (members). I
open both input and output file in binary mode and do the
transformation. However, I can't open the resulting file, Word just
telling that there was an error. Does anybody what I am doing wrong?
Oh, and is this...
|
by: sbettadpur |
last post by:
hello everybody,
i want to open word document file in browser, it means there will be one hyperlink if i click(ex: it's file.doc) on that it has to open the file in the browser.
thanks
| |
by: alok5505 |
last post by:
Hi All ,
I am new to Mobile development. I want to open word document in
mobile control. Also I should be able to edit and save it.
Is it possible to do it ?
I am using Microsoft .NET compact framework with Visual studio 2005.
Thanks and Regards
|
by: shanmugamit |
last post by:
i want open word document in frame but its ask open or save file..not open in frame....here is my code
<frameset cols="120,*">
<frame src='sample.html'>
<frame name='openfile' src='sample.doc'>
</frameset>
|
by: Peter |
last post by:
ASP.NET 2.0
I am trying to open a Word document and Excel document from a dialog web
page, what's the best way to do that?
I have tried the following:
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
file.Name);
|
by: Peter |
last post by:
I have the following code which is executed from a modal web page - it works
fine on most, but on some computers the Word loads into memory but never
displays. This occurs with IE6 and IE7, but always works on FireFox.
When I close the modal web page Word disappears from Memory.
I don't know where the problem is, my code, IE setup or intranet security, I
also do not know where and for what to look for - I've tried Google but I
don't know...
|
by: saketmayur |
last post by:
Hi ,
I have write the following code to open word document on server
using Microsoft.Office.Interop.Word;
string DocPath = System.Configuration.ConfigurationManager.AppSettings;
ApplicationClass wordApp = new ApplicationClass();
string filePath = "";
filePath = DocPath + Session + "/" + DocFile.Value.ToString();
|
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...
| |
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,...
|
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...
|
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...
|
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,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |