Hi
I am building a document from a pre-defined template and need to be able to save the document and then print it to a specified printer. I am using C# script to create the code (I am not a C# programmer!!), as shown below, and I am unable to get the printing part of the code to compile. Can I get some assistance or is there a manual I can view? Kind regards, Steve H.
using System;
using AWDotNetController;
using System.Collections.Generic;
using System.Text;
using Aspose.Words;
using Aspose.Words.Viewer;
namespace GenerateDocumentUsingAspose
{
public class GenerateDoc
{
[StartMethodAttribute()]
public void LBAMainDoc(ScriptParameters sp)
{
string Defendant_No = (string)sp.InputVariables["cDEFENDANT_NO"];
string Title = (string)sp.InputVariables["cTITLE"];
string Forename = (string)sp.InputVariables["cFORENAME"];
string Middle_Name = (string)sp.InputVariables["cMIDDLE_NAME"];
string Surname = (string)sp.InputVariables["cSURNAME"];
string Address_Line1 = (string)sp.InputVariables["cADDRESS_LINE1"];
string Address_Line2 = (string)sp.InputVariables["cADDRESS_LINE2"];
string Address_Line3 = (string)sp.InputVariables["cADDRESS_LINE3"];
string Address_Line4 = (string)sp.InputVariables["cADDRESS_LINE4"];
string Postcode = (string)sp.InputVariables["cPOSTCODE"];
string Client_ID = (string)sp.InputVariables["cCLIENT_ID"];
string Client_Name = (string)sp.InputVariables["cCLIENT_NAME"];
string Cosignor_Forename = (string)sp.InputVariables["cCOSIGNOR_FORENAME"];
string Cosignor_Middle_Name = (string)sp.InputVariables["cCOSIGNOR_MIDDLE_NAME"];
string Cosignor_Surname = (string)sp.InputVariables["cCOSIGNOR_SURNAME"];
decimal Current_Balance = (decimal)sp.InputVariables["cCURRENT_BALANCE"];
string DocName = (string)"Q:\\" + Client_ID + "\\" + Defendant_No + "\\LBAMain.doc";
Document doc = new Document("D:\\Litigation\\Templates\\Letters\\LBA.doc");
doc.MailMerge.Execute(
new string[] { "Field 1", "Field 2", "Field3", "Field4", "Field5", "Field6", "Field7", "Field8", "Field9", "Field 10", "Field11", "Field3", "Field4", "Field5", "Field12", "Field13", "Field14", "Field17" },
new object[] { Defendant_No, Title, Forename, Middle_Name, Surname, Address_Line1, Address_Line2, Address_Line3, Address_Line4, Postcode, Client_Name, Forename, Middle_Name, Surname, Cosignor_Forename, Cosignor_Middle_Name, Cosignor_Surname, Current_Balance });
doc.Save(DocName);
doc.printer.Settings("HP9mclarke");
doc.print();
}
}
}