平台优惠 | 商家优惠 | 菜品原价 | 餐盒费 | 菜品原价(餐盒费) | 配送费 |
&=item.restaurantPart | &=item.merchantActivityPart | &=item.foodTotalPrice | &=item.packageFee | &=&=H{r}+I{r} | &=item.deliverFee |
0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
&=$startTime |
说明:似乎必须要用&=user 这种格式 "&= : 标致变量
&=$company :变量绑定
&=user.sname :类对象集合变量绑定
&=&= :Excel动态公式引用
&=&=C{r}*E{r}:{r} 对应当前行, &=&=Sum(OFFSET(C$3,1,):OFFSET(C{r},-1,)) "
package org.canaan.aspose;
import com.aspose.cells.License;
import com.aspose.cells.Workbook;
import com.aspose.cells.WorkbookDesigner;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* excel 表格生成工具
public final class CellsDemo {
/**
* 签名
*
* @return
*/
public static boolean getLicense() {
boolean result = false;
InputStream is = CellsDemo.class.getClassLoader().getResourceAsStream("\\license.xml");
License aposeLic = new License();
try {
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
public static void main(String[] args) throws Exception {
List<Map<String, Object>> users = new ArrayList<>();
Map<String, Object> user = new HashMap<>();
user.put("rn", 1);
user.put("name", "张三");
user.put("id_card", "4564845fas");
user.put("age", 26);
user.put("special", "唱歌");
user.put("education", "高中");
user.put("sta_date", "");
user.put("end_date", "");
user.put("province", "");
user.put("registered_time", "");
user.put("three_exam_names", "其他");
user.put("duty", "组长");
users.add(user);
user = new HashMap<>();
user.put("rn", 2);
user.put("name", "王五");
user.put("id_card", "e4564fds");
user.put("age", 15);
user.put("education", "高中");
user.put("duty", "队长");
user.put("special", "篮球");
users.add(user);
user = new HashMap<>();
user.put("rn", 3);
user.put("name", "钱七");
user.put("id_card", "dartasdf");
user.put("age", 54);
user.put("education", "大学");
user.put("three_exam_names", "其他");
user.put("special", "篮球");
users.add(user);
Workbook wb = new Workbook("E:\\Project\\IdeaProjects\\cutil\\lib\\组人员信息表.xls");
WorkbookDesigner designer = new WorkbookDesigner();
designer.setWorkbook(wb);
designer.setDataSource("company", "xx科技");
designer.setDataSource("teamName", "研发部");
designer.setDataSource("exportTime", "2017-02-03");
designer.setDataSource("user", new MapCellsTable(users));
designer.process();
wb.save("E:\\Download\\test1.xls");
System.out.println("===完成==");
}
}