Thanks very much for your tip.
It seems that the workaround works for the smart markers, however the problem stays with dynamic formulas.
I have attached two files:
1) SmartMarkers.xls is the input template
2) MailMergedSmartMarkersExcel.xls is similar to the output file in case I use the code below where I try to implement your tip.
It seems that the inputTemplate's formulas (the cell H12 and others in H column) left in sheet after the Process(false) because cell.IsErrorValue is false.
So, hopefully the last question is if there is a trick how to remove unused "&=&=..." formulas
Thanks again for your advice.
Mirek
-------------------------------------------------------------------------------------
public static Workbook ExcelAspose(Template selectedTemplate, DataSet inputDataSet, bool removeEmptyParagraphs)
{
TraceLineToDiagnostic("OfficeTemplatesAspose.ExcelAspose called");
InicializeAsposeLicence();
<span style="color: blue;">var</span> templateStream = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">MemoryStream</span>(selectedTemplate.TemplateDocument.ToArray());
<span style="color: blue;">var</span> wd = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">WorkbookDesigner</span>
{
Workbook = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">Workbook</span>(templateStream)
};
wd.SetDataSource(inputDataSet);
wd.Process(<span style="color: blue;">false</span>);
TryToDeleteBlankRows(wd, removeEmptyParagraphs);
<span style="color: blue;">return</span> wd.Workbook;
}
<span style="color: blue;">private</span> <span style="color: blue;">static</span> <span style="color: blue;">void</span> TryToDeleteBlankRows(<span style="color: rgb(43, 145, 175);">WorkbookDesigner</span> wd, <span style="color: blue;">bool</span> removeEmptyParagraphs)
{
<span style="color: blue;">if</span> (!removeEmptyParagraphs) <span style="color: blue;">return</span>;
<span style="color: blue;">foreach</span> (<span style="color: rgb(43, 145, 175);">Worksheet</span> sheet <span style="color: blue;">in</span> wd.Workbook.Worksheets)
{
<span style="color: blue;">foreach</span> (<span style="color: blue;">var</span> cell <span style="color: blue;">in</span> sheet.Cells.Cast<<span style="color: rgb(43, 145, 175);">Cell</span>>().Where(cell => cell.IsErrorValue))
{
cell.PutValue(<span style="color: blue;">null</span>);
}
sheet.Cells.DeleteBlankRows();
}
}