Hello,
I am currently using Smart Markers in a project with numeric values and dates working as expected. The data is merged from an Xml-document into an Xlsx-template, see code at the end of this post for an example application. I have also attached sample Xml data and Merge Template.
However, when trying to use DateTime values these show up as text in the resulting document, while normal dates work fine. In the template, I have used the "numeric" parameter on the cells containing dates and datetimes. Formatting also works fine on the regular date values.
Is merge of both Date and DateTime values supported when executing Smart Markers, and if not, would it be possible to add support for this in a later version?
thanks,
Henrik
namespace AsposeCellsMerge { using System.Diagnostics; using System.IO; using System.Data;<span style="color: blue;">using</span> Aspose.Cells; <span style="color: blue;">class</span> <span style="color: rgb(43, 145, 175);">Program</span> { <span style="color: blue;">static</span> <span style="color: blue;">void</span> Main(<span style="color: blue;">string</span>[] args) { <span style="color: blue;">if</span> (args.Length < 2) { <span style="color: rgb(43, 145, 175);">Trace</span>.WriteLine(<span style="color: rgb(163, 21, 21);">"Invalid number of arguments: Expecting AsposeCellsMerge.exe <template> <data>"</span>); <span style="color: blue;">return</span>; } <span style="color: blue;">string</span> l_sourceFile = args[0]; <span style="color: blue;">if</span> (!<span style="color: rgb(43, 145, 175);">File</span>.Exists(l_sourceFile)) { <span style="color: rgb(43, 145, 175);">Trace</span>.WriteLine(<span style="color: rgb(163, 21, 21);">"Specified source file does not exist: "</span> + l_sourceFile); <span style="color: blue;">return</span>; } <span style="color: blue;">string</span> l_dataFile = args[1]; <span style="color: blue;">if</span> (!<span style="color: rgb(43, 145, 175);">File</span>.Exists(l_sourceFile)) { <span style="color: rgb(43, 145, 175);">Trace</span>.WriteLine(<span style="color: rgb(163, 21, 21);">"Specified data file does not exist: "</span> + l_dataFile); <span style="color: blue;">return</span>; } <span style="color: blue;">string</span> l_targetFile = l_sourceFile + <span style="color: rgb(163, 21, 21);">".xlsx"</span>; Aspose.Cells.<span style="color: rgb(43, 145, 175);">Workbook</span> l_workbook = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">Workbook</span>(l_sourceFile); <span style="color: rgb(43, 145, 175);">DataSet</span> l_xmlDataSet = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">DataSet</span>(); l_xmlDataSet.ReadXml(l_dataFile); <span style="color: blue;">var</span> l_designer = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">WorkbookDesigner</span>(); l_designer.Workbook = l_workbook; l_designer.SetDataSource(l_xmlDataSet); <span style="color: green;">// Process the smart markers</span> l_designer.Process(); l_designer.Workbook.CalculateFormula(<span style="color: blue;">true</span>); l_workbook.Save(l_targetFile, <span style="color: rgb(43, 145, 175);">FileFormatType</span>.Xlsx); } }
}