本文整理汇总了C#中System.Proxy.AssembleDocument方法的典型用法代码示例。如果您正苦于以下问题:C# Proxy.AssembleDocument方法的具体用法?C# Proxy.AssembleDocument怎么用?C# Proxy.AssembleDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Proxy
的用法示例。
在下文中一共展示了Proxy.AssembleDocument方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssembleDocument
/// <summary>
/// <c>AssembleDocument</c> assembles (creates) a document from the given template, answers and settings.
/// </summary>
/// <param name="template">An instance of the Template class, from which the document will be assembled.</param>
/// <param name="answers">The set of answers that will be applied to the template to assemble the document</param>
/// <param name="settings">settings that will be used to assemble the document.
/// These settings include the assembled document format (file extension), markup syntax, how to display fields with unanswered variables, etc</param>
/// <param name="logRef">A string to display in logs related to this request.</param>
/// <returns>returns information about the assembled document, the document type, the unanswered variables, the resulting answers, etc.</returns>
public AssembleDocumentResult AssembleDocument(Template template, TextReader answers, AssembleDocumentSettings settings, string logRef)
{
// Validate input parameters, creating defaults as appropriate.
string logStr = logRef == null ? string.Empty : logRef;
if (template == null)
throw new ArgumentNullException("template", string.Format(@"WebService.Services.AssembleDocument: the ""template"" parameter passed in was null, logRef: {0}", logStr));
if (settings == null)
settings = new AssembleDocumentSettings();
AssembleDocumentResult result = null;
AssemblyResult asmResult = null;
using (Proxy client = new Proxy(_endPointName))
{
OutputFormat outputFormat = ConvertFormat(settings.Format);
AssemblyOptions assemblyOptions = ConvertOptions(settings);
string fileName = GetRelativePath(template.GetFullPath());
asmResult = client.AssembleDocument(
fileName,
answers == null ? null : new BinaryObject[] { Util.GetBinaryObjectFromTextReader(answers) }, // answers
outputFormat,
assemblyOptions,
null);
SafeCloseClient(client, logRef);
}
if (asmResult != null)
{
result = Util.ConvertAssemblyResult(template, asmResult, settings.Format);
}
return result;
}