Implementation on a web site

Hello everyone. I have been trying to implement the following solution in my web application by various means, eventually ending up trying to use the Word interop assemblies but all advice tells me not to use interop on a web server. Hence, exploring Aspose.
The web application needs to capture a legal document that can be edited before saving. A number of fields, such as dates are completed that eventually go into forming the body of the document. We use Telerik components on the site so we used their editor to give us editing capabilities on the web page. This uses html to format the document. It is very similar to using the editor I’m typing this in.
Some mail merge type operations are performed to add a company name and address. The letter typically is three pages long. I had set up a Word template consisting of a graphic in a header and footer for the first page and on subsequent pages no header and the same footer as a continuation page. I then copied the text from the editor into the Word template. At first it pasted the raw html but I did some work on it to remove the html tags and use Word commands to keep the formatting (bold, underline etc.) to get the text how I wanted it.
My main problems were with printing. The editor control allows me to print but dealing with the headers and footers was impossible via html (or it was to me anyway!) and it wasn’t very good at dealing with page breaks so I placed the text into Word so it could use a template that did what I wanted when I pasted the text into it. It could then be printed from there.
WIll Aspose allow me to do this?
Does it remove the need for me to get rid of the html tags and keep the formatting?
Will I be able to use an asp.net server-side button to give me a print facility to get a hard copy of the document? This button will also update a database to say the document has been sent for printing.

  • Will I be able to create a template (in Word?) so that it will deal with the headers and footers in the way I described above?
  • Does Aspose allow me to manipulate text to provide formatting, such as bold, italic etc.
  • Other questions are:
  • How does it work with the web server?
  • Is it all server based or is some of it client based?

I had trialed the OfficeWriter product (can’t remember who does it) a while ago but it wasn’t very easy to use in that it embedded a document in an SQL server reporting service report. Does Aspose work in a similar manner to this. I’m hoping I can just create a regular Word template with the headers and footers and ‘copy and paste’ the html text in the editor control into the template.
Sorry it’s a long message but I’m rather short of time to get this working and I need to try and think of all the questions to ask in as few emails as possible. I hope it all makes sense!
Thanks for your help.

Thinking of more requirements and questions!
As well as printing out a single document, I also need to do batch printing of them. I need to be able to pick from a list of companies that already have saved documents in the database and print them all out in one go, maintaining the headers/footers and continuation pages.
In Word this would be done by seperating each document with a section break.
Is this possible?
Thanks for your help.

Hi
Thanks for your request.

  1. Aspose.Words has ability to work with html:
  1. The Aspose.Words.Viewer namespace provides classes to render and print Word documents without utilizing Microsoft Word. To print document you can use the following simple code:
Document doc = new Document("in.doc");
DocumentRenderer renderer = new DocumentRenderer(doc);
renderer.Print();

But note this feature is currently in beta and limited technical support is provided for it.

  1. Yes you can achieve this. You also can create header and footer programmatically. See the following link for more information.
    https://docs.aspose.com/words/net/working-with-headers-and-footers/
  2. Yes, of course you can set formatting of text. Please see the following link for more information.
    https://reference.aspose.com/words/net/aspose.words/font/
  3. Aspose.Words for .NET by itself is just a .NET class library for document conversions, report generation and document programmatic access and as such does not have any built-in web or other fancy stuff. Therefore it is very easy to use from any .NET application be it an ASP.NET, Windows Forms etc.
  4. Aspose.Words is server based. There is no client side API.
  5. You can concatenate documents using Aspose.Words. Please see the following link for more information.
    https://docs.aspose.com/words/net/insert-and-append-documents/

Also I would like to advice you to check Aspose.Editor component. Aspose.Editor is a .NET word processing control for ASP.NET and Windows Forms applications. Aspose.Editor displays, edits and prints documents a lot like Microsoft Word, but inside your application. DOC, RTF, WordprocessingML and HTML documents are supported with a unique feature of lossless editing even for complex documents. Please see the following link for more information.
https://products.groupdocs.com/editor/net/
Hope the provided information could be useful for you.

Best regards.

Thanks for the reply. I’ve isntalled a trial version and its already doing what I need it to even though I’ve only been using for a couple of hours so things are looking promising.
However, on one of my pages I have a datagrid that uses the ItemdataBound event to render a row in a different color - ‘item.ForeColor = Drawing.Color.red’
When I add the ‘Imports Aspose.Word’ line to start using the document object model I get an error stating that ‘Color is not a member of Drawing’.
It looks like Aspose uses a ‘Drawing’ class as well as the standard core libraries. Is this a known issue - I can get round it be sepcifying ‘System.Drawing.Color’ but is there another solution?
Thanks

Hi
Thanks for your request. I never have seen this error before. Could you please provide me your code that will allow me to reproduce this issue?
Best regards.

I will try to post my code to help with this but unfortunately I’m in a race against time to get things working.
The next question I have is to confirm licencing and pricing. I have looked around your site at this and think I know what it’s going to cost but I’d like to confirm it before going to the people that will have to pay for it.
I work for a company that has a headquarters and six satellite offices. My web application will be based on a server at the head office. All the other offices will access the application via this one server. I will be the only developer using the product.
Could you please tell me the correct subscription I need to buy? Thanks

Hello!
Thank you for your inquiry.
Under these conditions you need Developer Enterprise Subscription, namely the cheapest one. See this page:
https://purchase.aspose.com/
Regards,

Dear Gavin,
Just to confirm that Viktor is right. Since, your application will be deployed in only ONE physical location (a server at the head office) and you will be the only developer using Aspose.Words so, Developer Enterprise Subscription will suffice your needs. It will cost you $899. Once you buy this subscription, you will be able to download new product releases, hotfixes etc. FREE for 1 year. However, our forum support is absolutely FREE. So, even your subscription expires, you can continue to seek help from our technical support developers. But, you won’t be able to use new product versions, hotfixes etc. that will be released after your subscription expiry time. However, you would be able to Renew your subscription any time by just paying 50% of the actual amount if you renew before your subscription expiration otherwise it’s 60%.
I hope, it would help.
Have a good time.

That’s excellent news. Thanks very much. I think I have just one final queryconcerning deploying the application to a server.
In opening an existing Word document - the one I will be using as a template - it requires a physical path (C:…). In simple web sites, files are accessed relative to the sites root directory, so could you tell me if there are any special requirements for setting up permissions to access the templates on the server? Do I need to allow the ‘ASPNET’ account permission to access the file, or store them in a directory and set the permission for that?
Thanks very much for your help.

Hi
Thanks for your inquiry. I think that you should create subfolder in the root folder of your web application and store all documents there. Then you can access these documents using Server.MapPath. For example see the following code:

Document doc = new Document(Server.MapPath(@"documents\mydoc.doc"));

Hope this helps.
Best regards.