try
{
var dataSourceInfos = new List();
if (partialTemplates.HasValue)
{
var dataSource = new DataSourceInfo(partialTemplates.Value.Value, partialTemplates.Value.Key);
dataSourceInfos.Add(dataSource);
}
AddDataSources(dataSourceDefinitions, dataSourceStreams, dataSourceInfos);
FileFormat groupDocsFileFormat = ConvertFileFormat(outputFileFormat);
using (var templateStream = new MemoryStream(template))
{
using (var outputStream = new MemoryStream())
{
var assembler = new DocumentAssembler
{
Options = DocumentAssemblyOptions.AllowMissingMembers | DocumentAssemblyOptions.InlineErrorMessages | DocumentAssemblyOptions.UpdateFieldsAndFormulas
};
// todo: load by convention
assembler.KnownTypes.Add(typeof(StringExtensions));
assembler.AssembleDocument(
templateStream,
outputStream,
new LoadSaveOptions(groupDocsFileFormat),
dataSourceInfos.ToArray());
output.Report = outputStream.ToArray();
return output;
}
}
}
finally
{
DisposeAllDataSourceStreams(dataSourceStreams);
}
Thanks for the details. It seems, that your requirements can be met by changing the template. However, to ensure that, we need a code sample getting the template and JSON file provided and producing a result document. Unfortunately, the code your shared earlier does not compile as it has many missing dependencies. Could you please share a standalone console app without compilation errors that transforms the template and data into a result document?
Well, in the first post i have uploaded a zip file with the JSON and the template.
That’s all what’s needed and a default groupdocs call like the code we gave. There are no extension in this Template used.
Just take the same options, and insert the json with name: ‘TIProjectDetails’
If that doesn’t work, the concept idea we are trying to accomplish is clear right? Is it possible you create a small example that shows how it should be used inline, with cells on the side?
It helped to build a document from the template you shared. We are attaching a modified template producing a required result at the first sheet - Template_Groupdocs_Modified.zip (55.6 KB). Let us know if it works for you.