m w
asked on
Issue with word document (need alternative solution) urgently
Dear Team,
I need your advice on the below issue :
I am trying to automate the word to be filled programmatically but due to security restrictions in my company the users are not able to print the document.
So what you suggest to do in this case instead of using the word document in ASP.NET (VB.NET language), is there any method to allow user to print the form without using word.
Can you explain the workflow?
You could use the office online server https://docs.microsoft.com/en-us/officeonlineserver/office-online-server
You could use the office online server https://docs.microsoft.com/en-us/officeonlineserver/office-online-server
ASKER
Hello
I meaning if there is any other solution to implement same word document template in crystal report with easy way instead of using MS office.
I don't mean by anyway to hack the policy of my company
I meaning if there is any other solution to implement same word document template in crystal report with easy way instead of using MS office.
I don't mean by anyway to hack the policy of my company
Is this a form on a website you want to be filled out or a form in a desktop application?
ASKER
its form on a website
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Have the form in HTML instead, then serve the PDF to the user (since you mentioned the word "printing"):
Totally free:
https://www.nuget.org/packages/HtmlRenderer.PdfSharp/
Totally free:
https://www.nuget.org/packages/HtmlRenderer.PdfSharp/
ASKER
Scott Fell
Here is the work flow:
- The user search for customer ID
- The data fetched from database and then displayed to user
- The user updated the data and then data saved again in database
- Finally the user will print form with new data using existing word template.
The issue here that the process take a long time (as admin user) also the user not able to open the word document to fill with new data (client user)
Here is the work flow:
- The user search for customer ID
- The data fetched from database and then displayed to user
- The user updated the data and then data saved again in database
- Finally the user will print form with new data using existing word template.
The issue here that the process take a long time (as admin user) also the user not able to open the word document to fill with new data (client user)
For the purpose of this question, we can deal with the printing issue here. Taking a long time for the Admin user would be something for a different question. It is best to keep things succinct here.
For printing purposes, why not just create a report in .NET that recreates the form layout and from there the user can print the browser screen. You can still have a connector that fills in the word document or at least provide data that the word document can import and it would be up to the user to decide how to manage the word document. For your printing purposes, if you create screen somebody can print from, that solves the problem of keeping the data secure in the database and allows the user to print the document out.
Of course, any print out can be scanned and OCR'd and data can be extracted that way.
For printing purposes, why not just create a report in .NET that recreates the form layout and from there the user can print the browser screen. You can still have a connector that fills in the word document or at least provide data that the word document can import and it would be up to the user to decide how to manage the word document. For your printing purposes, if you create screen somebody can print from, that solves the problem of keeping the data secure in the database and allows the user to print the document out.
Of course, any print out can be scanned and OCR'd and data can be extracted that way.
ASKER
I create form using Multiview, each screen has different values. The user should be filled all required fields first then print document that stored on the server. The system will fill up the document with new data and the user should view the document with new data. Currently this process take long time but i am still beginner and don't know if there is another way to fill out all data in fastest way.
Please help me
Please help me
then print document that stored on the server.
It seems like there was a step that was left out Let's make sure we have this correct. Based on what you posted previously if I number those steps, we end up with below.
1) The user search for customer ID
2) The data fetched from database and then displayed to user
3) The user updated the data and then data saved again in database
4) Finally the user will print form with new data using existing word template.
Are you now saying that after step 3, you are generating a word document from the data that is stored on the server? I bolded the changes below. If this is not correct or there are other steps missed, please update what I have.
1) The user search for customer ID
2) The data fetched from database and then displayed to user
3) The user updated the data and then data saved again in database
4) Word document is create from the data from the prior steps
5) Finally the user will print Word document that is stored on the server
ASKER
Yes that's correct
1) The user search for customer ID
2) The data fetched from database and then displayed to user
3) The user updated the data and then data saved again in database
4) Word document is create from the data from the prior steps
5) Finally the user will print Word document that is stored on the server
1) The user search for customer ID
2) The data fetched from database and then displayed to user
3) The user updated the data and then data saved again in database
4) Word document is create from the data from the prior steps
5) Finally the user will print Word document that is stored on the server
For step 5, what I am suggesting is to recreate a single web page that is set up for printing that will have the similar look as the word document.
Or you can generate a PDF if that is easier for the user. But generating a pdf may be more complex on your end. There are free, open source libraries such as http://www.pdfsharp.net/. There are also going to be paid libraries that may be easier to use.
You also mentioned Crystal Reports. You can connect your db to a reporting tool and perhaps get what you need as well.
These are all options to work around printing from word.
Or you can generate a PDF if that is easier for the user. But generating a pdf may be more complex on your end. There are free, open source libraries such as http://www.pdfsharp.net/. There are also going to be paid libraries that may be easier to use.
You also mentioned Crystal Reports. You can connect your db to a reporting tool and perhaps get what you need as well.
These are all options to work around printing from word.
ASKER
Thanks but could you please advise or provide example how to create a single web page to print the document
steps 4 and 5 are unnecessary. You don't need a word document. Just create a minimal web page that contains the data based on your sql query of the database
Give whatever element you want to print the id printMe.
Include this script in your head tag:
Give whatever element you want to print the id printMe.
Include this script in your head tag:
<script language="javascript">
var gAutoPrint = true;
function processPrint(){
if (document.getElementById != null){
var html = '<HTML>\n<HEAD>\n';
if (document.getElementsByTagName != null){
var headTags = document.getElementsByTagName("head");
if (headTags.length > 0) html += headTags[0].innerHTML;
}
html += '\n</HE' + 'AD>\n<BODY>\n';
var printReadyElem = document.getElementById("printMe");
if (printReadyElem != null) html += printReadyElem.innerHTML;
else{
alert("Error, no contents.");
return;
}
html += '\n</BO' + 'DY>\n</HT' + 'ML>';
var printWin = window.open("","processPrint");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint) printWin.print();
} else alert("Browser not supported.");
}
</script>
Call the function<a href="javascript:void(processPrint());">Print</a>
And... what you're really asking is, "How do I hack/break/defeat my company's internal security policy?"
Likely there's a reason for this policy.
Depending on exactly how the policy is implemented will determine you how hack/break/defeat your company's policy.
Simple solution is to just ship the document to some rogue printer you setup, which is outside the security policy.