Using aspose.Word with classic asp

I’m trying to use aspose.Word with classic asp, so far I’ve been able to create the object and open the Word doc in question, from here I want to save it as html but I can’t specify the format?

doc.Save(Server.MapPath("thepage.htm"), ???)

Using “Saveformat.FormatHtml” obviously wont work as “Saveformat” isn’t defined.

The reason I’m using aspose is because we convert users Word docs into html but it does have it’s problems like Word docs being corrupt and hanging Word on the server so chewing memory, another problem would be if some stupid user put a password on their doc, again it would hang using the normal Word.Application object. I presume aspose might have ways to get round this? It would be very handy if it does

Ian.

Hi Ian,
I’m going to create a knowledge base article that makes a summary of how to use Aspose.Word from classic ASP or any other COM client. It will include some samples that would help you to solve your problem. The article will be completed in a few days.

Great! I’ll be looking forward to this as well.

Kewl, I’ll look forward to going through it.

Thanks.

bump… any progress?

The reason the article was delayed is because we were implementing another Document.Save method specially designed for use in COM and interaction with classical ASP Response object. We wanted to show how to use it in a code example included in the article. The method will be released in the next hotfix and the article will be posted at the same time.

Sounds good, I guess it’s finally time to purchase a copy

Published:

I would like to read this article, but the link appears dead. Can you direct me to its new location? Thanks

Sure. Here it is:
https://docs.aspose.com/words/net/supported-platforms/#com

Hi Dmitry. Thanks for the prompt reply. I got Aspose.Words working with my Classic ASP app right away.

I wonder if I could ask another question? From reading the article, I haven’t figured out how to access a few namespaces via COM. In particular, I can’t access paper size constants (PaperSize.A4, PaperSize.Letter, etc) and Section commands (SectionStart.NewPage, etc).

My guess was that it’s the Aspose.Words.ComHelper COM object, but I couldn’t get that to work. Can you help?

Thanks again for your help, Dmitry. Much appreciated!

Hi,

Consider the following:

Enumeration values like BreakType.SectionBreak - you will need to generate a type library from Aspose.Words.dll and open it in some type library viewer to lookup the enumeration values. You can view a type library using Microsoft Visual Basic 6, Visual Basic for Applications in Microsoft Word or OLE Viewer.

Besides, you can download a free TLB viewer from here:
<http://www.e-cactus.com/~sherwin/TLBviewer/

Using this tool, you can find enumeration values at the “Aliases and Enums” section or export the TLB file to a bunch of HTML documents, one document per type. For example, here is the value for PaperSize.A4:

HelpString:

const long

PaperSize_A4 = 1

I am also attaching Aspose.Words enumeration values for COM for your convenience.

Best regards,

Thanks Dmitry and miklovan for your responses. I am very impressed with how responsive you guys are on this forum.

miklovan: I didn’t see any attachment to the post. But it’s OK, I downloaded the utility that Dmitry suggested, and I have been able to find the numerical values of the constants from the .net enumerations that I need.

Dmitry: Thanks, the TLBViewer is working for me, and helping a lot. For the sake of reference, I note that the TLBViewer that I’m using was unable to open the Aspose dll. Before I got it to work, I had to get into my .NET command line (Start --> Programs --> Microsoft .NET Framework SDK --> SDK Command Prompt) and then run tlbexp C:\Program Files\Aspose\Aspose.Words\Bin\net2.0\Aspose.Words.dll /out:Aspose.Words.tlb. Then I was able to open the TLB with the TLBViewer

I’m still having a little trouble though. I can’t find the DocumentBuilder’s PageSetup property.

Example .NET code from the API here shows things like

DocumentBuilder builder = new DocumentBuilder();
builder.PageSetup.Orientation = Orientation.Landscape;

I translate this into VBScript/ASP as

Set Builder = Server.CreateObject("Aspose.Words.DocumentBuilder")
Builder.PageSetup.Orientation = 2

(here, 2 is the value for Orientation_landscape, gleaned from the type viewer).

However, I get an “Object doesn’t support this property or method” error when I try this code. I did see a _PageSetup interface in the TLBViewer, but I haven’t been able to figure out how to access it.

So can I impose for a little more assistance?

Thanks

Strange, your code looks okay and runs okay on my machine. What version of Aspose.Words do you use? What is the full text of the error?

Oh, actually, I guess it was a typo on my part. Maybe I’ve got it doing everything I want it to now. Thanks so much for all your help!!