Lodop export excel with digital format

In excel, selected cells, right property, you can see a cell format setting function, which the tab number, there are many built-in format, in addition may be a custom format.

lodop when exporting the table, if necessary with the format, can be used xformat provided, see the specific format described excel cell formatting inside or Baidu excel related information about cell formatting.

Since excel in many formats, tested here a few, most are normal, just guided by the date when the view or the original format, but a few clicks of the date cell, and then switch to another cell, the date is export of xformat format, the specific reasons unknown, the date cell right cell formatting where you can see the format you need, click it to switch to the other cells in normal, it may be installed excel software problem, in short, the test of this format can be exported several normal. (Because it is in digital format , if there are non-digital content, as will be output)

Test code:

<script language="javascript" src="LodopFuncs.js"></script>
</head>
<body>
<div id="d1">
<table width="100%" border=1 style="border-collapse:collapse;">
<tr>
    <td xformat="¥#,##0.00">12</td>
    <td xformat="@">12</td>
</tr>
<tr>
    <td colspan=2 style="background-color:gray">14</td>
<tr>
    <td xformat="#,##0.00">11.7777777777</td>
    <td xformat="0.00%">0.23666</td>
</tr>
<tr>
    <td xformat="#,##0.00">Td</Character 11.7777>
    <td xformat="0.00%">0.236文本66</td>
</tr>
<tr>
    <td xformat="#,###.00元">11.7777</td>
    <td xformat="#,###.00人民币">3.2366</td>
</tr>
<tr>
    <td xformat="#,###.00卡卡卡">11.7777</td>
    XformatTD<= "yyyy mm on January" > 2019/11 </ TD > 
</ TR > 
</ Table > 
</ div > 
< A the href = "JavaScript: OutToFileOneSheet ()" > export format of excel test </ A > < br > 
< Script Language = "JavaScript" type = "text / JavaScript" >    
        var LODOP; // declare a global variable 
    function OutToFileOneSheet () { 
        LODOP = getLodop ();    
        LODOP.PRINT_INIT(""); 
        LODOP.ADD_PRINT_TABLE(100,20,500,60,document.getElementById("d1").innerHTML); 
        LODOP.SAVE_TO_FILE("导出excel的格式.xlsx"); 
        };
</script> 
</body>

Icon:

Guess you like

Origin www.cnblogs.com/huaxie/p/12156271.html