var ejsexcel = require (' Ejsexcel ');
var fs = require (' Fs-extra ');
The previous blog post has explained the export of Excel through Ejsexcel, through the creation of templates to export Excel, now need to merge cells, through the ejsexcel on git instructions, but also completed the export of Excel, because in the template by <%%> Can write arbitrary JS code, so the merge cell is also a case, now subdivide.
This is the code in the template, that is, JS judgment.
5. This is the background JS code, as to determine whether to merge cells and how many cells to merge the code.
6. This is the result of the merger, although the background code is not very concise, I pass in this one idea is that in Ejsexcel said is <%MERGECELLFN(c2:c3)%> merge C2 and C3 two units, In this way, the data can be written in the background, in the template to determine whether the match, and the need to merge the cells in the descendants of the logical processing, passed to the foreground; we don't know where we are. Data is what cells need to be merged and everything is live data.
Nodejs+ejsexcel do Excel complex export, merge cells