Showing posts with label automation. Show all posts
Showing posts with label automation. Show all posts

Thursday, March 29, 2012

office automation

Hello,

I have written a bunch of apps in vb .net that automated different office apps. I am very new to asp however. I created an asp .net web application in vs net added a button to a form and inserted this code:


Dim xlapp As Excel.Application
Response.Write("excel")
'Response.Write("fname = " & Fname)
xlapp = New Excel.Application

and it crashes with an access denied error

ive read some things on line about automating office with asp but they always seem to use c code and i would much rather use vb code

any help/advice or places i can go to read up on this would be greatly appreciated

ThanksHi,

Take a look @.Create and Modify Excel Files (VB)

HTH

Office Automation - Powerpoint in VB.Net

Hi

I tried to do the Powerpoint presentation using VB.Net 2.0. I got error while creating the object of the Powerpoint.Application

Unable to cast COM object of type 'PowerPoint.ApplicationClass' to interface type 'PowerPoint._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{91493442-5A91-11CF-8700-00AA0060263B}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).


Can any one tell me the solution for this error.?

Ganesh.

Hi Ganesh,

The error indicates that the PowerPoint.ApplicationClass was not registered on the running machine properly. A COM class needs to be registered in the registery to make it identified. The register process is done at the installation phase of Office.

So you can try to repair the installation of PowerPoint or make sure it is installed properly.

Further more, in an ASP.NET application, server side automation is not supported. Here is a KB article about this.

http://support.microsoft.com/kb/257757/en-us

Hope this helps.

office automation

I want to count words of .doc ,.ppt,.xls,.html,.rtf i done all things with
interop but it is not working on my webserver so do you know any component by
which i give facility in my application to count words
Kbalz wrote:

Quote:

Originally Posted by

Quote:

Originally Posted by

Quote:

Originally Posted by

you say for this link i try it but it is not working


>>


>[quoted text clipped - 14 lines]

Quote:

Originally Posted by

>Mark Rae
>ASP.NET MVPhttp://www.markrae.net


>
>The automation could save you $500 quickly depending on what scale of
>usage you are talking about.


--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Fo...sp-net/200710/1"akshar108 via DotNetMonster.com" <u37462@.uwewrote in message
news:79383d837bf05@.uwe...

Quote:

Originally Posted by

I want to count words of .doc ,.ppt,.xls,.html,.rtf i done all things with
interop but it is not working on my webserver so do you know any component
by
which i give facility in my application to count words


http://www.aspose.com/Products/Default.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

office automation securiy error

Hi. While trying to create a a word document in one of my asp.net pages I
keep getting an ASP.NET permission error. first I thought it was been caused
while trying to save the document, and I added permissions for the ASP.NET
account to my folders. after that I realized that the error was being
launche at the very first line of my function:
Word.ApplicationClass WordApp = new Word.ApplicationClass();
any ideas on how to solve this?
Thanks a lot,
Alejandro.For those who need the answer visit this link:
http://www.codeproject.com/aspnet/w...9372#xx999372xx
"Alejandro Penate-Diaz" <alexware69@.hotmail.com> wrote in message
news:%239TUIGSOFHA.1476@.TK2MSFTNGP09.phx.gbl...
> Hi. While trying to create a a word document in one of my asp.net pages I
> keep getting an ASP.NET permission error. first I thought it was been
> caused while trying to save the document, and I added permissions for the
> ASP.NET account to my folders. after that I realized that the error was
> being launche at the very first line of my function:
> Word.ApplicationClass WordApp = new Word.ApplicationClass();
> any ideas on how to solve this?
> Thanks a lot,
> Alejandro.
>
>
Not to be a nark or anything, but I think the licensing for office prohibits
this sort of usage on a webserver. Or, rather, you're supposed to have a
license for office for each user using your web application. At least this
is my understanding. I'd check the EULA.
BTW, this should be unrelated to the permission problem ;)
-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hi. While trying to create a a word document in one of my asp.net
> pages I keep getting an ASP.NET permission error. first I thought it
> was been caused while trying to save the document, and I added
> permissions for the ASP.NET account to my folders. after that I
> realized that the error was being launche at the very first line of my
> function:
> Word.ApplicationClass WordApp = new Word.ApplicationClass();
> any ideas on how to solve this?
> Thanks a lot,
> Alejandro.
It's probably a security issue.
The ASPNET user account does have permission to run office by default.
You can use impersonation to have ASP.NET run under a different user account
that does have the necessary permission.
For example, you can add a line similar to this to your web.config file:
<identity impersonate="true" userName="domain\MyUserName">
password="password"/>
Here's more info on impersonation:
http://msdn.microsoft.com/library/d...personation.asp
Here's more info on generating office documents, including the wrong ways
(like office automation) and the right ways:
http://SteveOrr.net/articles/ExcelExport.aspx
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Alejandro Penate-Diaz" <alexware69@.hotmail.com> wrote in message
news:%239TUIGSOFHA.1476@.TK2MSFTNGP09.phx.gbl...
> Hi. While trying to create a a word document in one of my asp.net pages I
> keep getting an ASP.NET permission error. first I thought it was been
> caused while trying to save the document, and I added permissions for the
> ASP.NET account to my folders. after that I realized that the error was
> being launche at the very first line of my function:
> Word.ApplicationClass WordApp = new Word.ApplicationClass();
> any ideas on how to solve this?
> Thanks a lot,
> Alejandro.
>
>

office automation securiy error

Hi. While trying to create a a word document in one of my asp.net pages I
keep getting an ASP.NET permission error. first I thought it was been caused
while trying to save the document, and I added permissions for the ASP.NET
account to my folders. after that I realized that the error was being
launche at the very first line of my function:

Word.ApplicationClass WordApp = new Word.ApplicationClass();

any ideas on how to solve this?
Thanks a lot,
Alejandro.For those who need the answer visit this link:
http://www.codeproject.com/aspnet/w...9372#xx999372xx

"Alejandro Penate-Diaz" <alexware69@.hotmail.com> wrote in message
news:%239TUIGSOFHA.1476@.TK2MSFTNGP09.phx.gbl...
> Hi. While trying to create a a word document in one of my asp.net pages I
> keep getting an ASP.NET permission error. first I thought it was been
> caused while trying to save the document, and I added permissions for the
> ASP.NET account to my folders. after that I realized that the error was
> being launche at the very first line of my function:
> Word.ApplicationClass WordApp = new Word.ApplicationClass();
> any ideas on how to solve this?
> Thanks a lot,
> Alejandro.
>
Not to be a nark or anything, but I think the licensing for office prohibits
this sort of usage on a webserver. Or, rather, you're supposed to have a
license for office for each user using your web application. At least this
is my understanding. I'd check the EULA.

BTW, this should be unrelated to the permission problem ;)

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hi. While trying to create a a word document in one of my asp.net
> pages I keep getting an ASP.NET permission error. first I thought it
> was been caused while trying to save the document, and I added
> permissions for the ASP.NET account to my folders. after that I
> realized that the error was being launche at the very first line of my
> function:
> Word.ApplicationClass WordApp = new Word.ApplicationClass();
> any ideas on how to solve this?
> Thanks a lot,
> Alejandro.
It's probably a security issue.
The ASPNET user account does have permission to run office by default.
You can use impersonation to have ASP.NET run under a different user account
that does have the necessary permission.

For example, you can add a line similar to this to your web.config file:
<identity impersonate="true" userName="domain\MyUserName">
password="password"/
Here's more info on impersonation:
http://msdn.microsoft.com/library/d...personation.asp

Here's more info on generating office documents, including the wrong ways
(like office automation) and the right ways:
http://SteveOrr.net/articles/ExcelExport.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Alejandro Penate-Diaz" <alexware69@.hotmail.com> wrote in message
news:%239TUIGSOFHA.1476@.TK2MSFTNGP09.phx.gbl...
> Hi. While trying to create a a word document in one of my asp.net pages I
> keep getting an ASP.NET permission error. first I thought it was been
> caused while trying to save the document, and I added permissions for the
> ASP.NET account to my folders. after that I realized that the error was
> being launche at the very first line of my function:
> Word.ApplicationClass WordApp = new Word.ApplicationClass();
> any ideas on how to solve this?
> Thanks a lot,
> Alejandro.
>

Saturday, March 24, 2012

OLE Automation by Javascript

i wrote this js function in HTML:

function OpenWord()
{
var a = new ActiveXObject("Word.Application"); a.Visible = true;
a.WindowState = 1; window.blur(); a.Activate();
}

if the it runs at localhost, it is OK, but it fail to create object when
running at other client. ( The same Office suite was installed in server &
client).

How to create a new WORD document ? Any ideas in operating VBA on
ActiveXObject? thanks.

Kosic.Hi,

It's generally a wrong thing to do. Office automation objects are not marked
as safe for scripting and therefore an attempt to access such objects from
client-side Javascript will result in denied access unless the website is
being opened in the My Computer zone (which happens when you test the
JavaScript on your development PC).

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Kosic" <kosic@.sina.com> wrote in message
news:OGYLTr3nDHA.2772@.TK2MSFTNGP12.phx.gbl...
> i wrote this js function in HTML:
> function OpenWord()
> {
> var a = new ActiveXObject("Word.Application"); a.Visible = true;
> a.WindowState = 1; window.blur(); a.Activate();
> }
> if the it runs at localhost, it is OK, but it fail to create object when
> running at other client. ( The same Office suite was installed in server &
> client).
> How to create a new WORD document ? Any ideas in operating VBA on
> ActiveXObject? thanks.
> Kosic.
"Dmitriy Lapshin [C# / .NET MVP]" <x-code@.no-spam-please.hotpop.com> wrote in message news:<#HVY7P4nDHA.1488@.TK2MSFTNGP12.phx.gbl>...
> Hi,
> It's generally a wrong thing to do. Office automation objects are not marked
> as safe for scripting and therefore an attempt to access such objects from
> client-side Javascript will result in denied access unless the website is
> being opened in the My Computer zone (which happens when you test the
> JavaScript on your development PC).
> --
> Dmitriy Lapshin [C# / .NET MVP]
> X-Unity Test Studio
> http://x-unity.miik.com.ua/teststudio.aspx
> Bring the power of unit testing to VS .NET IDE
> "Kosic" <kosic@.sina.com> wrote in message
> news:OGYLTr3nDHA.2772@.TK2MSFTNGP12.phx.gbl...
> > i wrote this js function in HTML:
> > function OpenWord()
> > {
> > var a = new ActiveXObject("Word.Application"); a.Visible = true;
> > a.WindowState = 1; window.blur(); a.Activate();
> > }
> > if the it runs at localhost, it is OK, but it fail to create object when
> > running at other client. ( The same Office suite was installed in server &
> > client).
> > How to create a new WORD document ? Any ideas in operating VBA on
> > ActiveXObject? thanks.
> > Kosic.

I have also had a similiar problem and in addition to the advice
provided by Dmitriy, you may want to try the following:

In the IE Browser, goto to Tools-->Internet options--> Security and
add the server to your list on trusted sites (when prompted, provide
http://yourmachinename as a trusted site). This helped me with my
problem.