use of cn.cerc.jdb.core.Record in project summer-bean by cn-cerc.
the class FormTemplate method output.
@Override
public void output(WritableSheet sheet) throws RowsExceededException, WriteException {
// 输出列头
Record head = this.getDataSet().getHead();
if (heads != null) {
for (int lineNo = 0; lineNo < heads.size(); lineNo++) {
Column column = heads.get(lineNo);
int row = this.getRow() + lineNo;
Label item1 = new Label(0, row, column.getName());
sheet.addCell(item1);
// Label item2 = new Label(1, lineNo,
// head.getString(column.getCode()));
// sheet.addCell(item2);
column.setRecord(head);
writeColumn(sheet, 1, row, column);
}
// 设置新的起点行号
this.setRow(this.getRow() + heads.size());
}
// 输出原来的表格
super.output(sheet);
// 输出合计
if (footer != null)
footer.output(this, sheet);
}
use of cn.cerc.jdb.core.Record in project summer-bean by cn-cerc.
the class InvoiceTemplate method output.
@Override
public void output(Document document, PdfWriter writer) throws DocumentException, IOException {
BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
// 设置中文字体和字体样式
Font f8 = new Font(bfChinese, 8, Font.NORMAL);
Font f18 = new Font(bfChinese, 18, Font.NORMAL);
document.addTitle(this.getFileName());
// 页标题
Paragraph title = new Paragraph(this.getFileName(), f18);
title.setAlignment(Element.ALIGN_CENTER);
document.add(title);
// 空一行
document.add(new Paragraph(" ", f18));
// 创建一个N列的表格控件
PdfPTable pdfTable = new PdfPTable(2);
// 设置报表为无边框
pdfTable.getDefaultCell().setBorder(PdfPCell.NO_BORDER);
// 设置表格占PDF文档100%宽度
pdfTable.setWidthPercentage(100);
// 水平方向表格控件左对齐
pdfTable.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
// 创建一个表格的表头单元格
PdfPCell pdfTableHeaderCell = new PdfPCell();
// 设置表格的表头单元格颜色
pdfTableHeaderCell.setBackgroundColor(new BaseColor(240, 240, 240));
pdfTableHeaderCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
// 设置表头栏位
pdfTableHeaderCell.setPhrase(new Paragraph("名称", f8));
pdfTable.addCell(pdfTableHeaderCell);
pdfTableHeaderCell.setPhrase(new Paragraph("信息", f8));
pdfTable.addCell(pdfTableHeaderCell);
// 创建一个表格的正文内容单元格
PdfPCell pdfTableContentCell_1 = new PdfPCell();
pdfTableContentCell_1.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
pdfTableContentCell_1.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
PdfPCell pdfTableContentCell_2 = new PdfPCell();
pdfTableContentCell_2.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
pdfTableContentCell_2.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
// 表格内容行数的填充
dataSet.first();
while (dataSet.fetch()) {
Record record = dataSet.getCurrent();
for (Column column : this.getColumns()) {
pdfTableContentCell_1.setPhrase(new Phrase(column.getName(), f8));
pdfTable.addCell(pdfTableContentCell_1);
String field = column.getCode();
pdfTableContentCell_2.setPhrase(new Paragraph(record.getString(field), f8));
pdfTable.addCell(pdfTableContentCell_2);
}
}
document.add(pdfTable);
}
use of cn.cerc.jdb.core.Record in project summer-bean by cn-cerc.
the class Template method output.
public void output(Document document, PdfWriter writer) throws DocumentException, IOException {
BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
// 设置中文字体和字体样式
Font f8 = new Font(bfChinese, 8, Font.NORMAL);
Font f18 = new Font(bfChinese, 18, Font.NORMAL);
document.addTitle(this.getFileName());
// 页标题
Paragraph title = new Paragraph(this.getFileName(), f18);
title.setAlignment(Element.ALIGN_CENTER);
document.add(title);
// 空一行
document.add(new Paragraph(" ", f18));
// 创建一个N列的表格控件
PdfPTable pdfTable = new PdfPTable(this.getColumns().size());
// 设置表格占PDF文档100%宽度
pdfTable.setWidthPercentage(100);
// 水平方向表格控件左对齐
pdfTable.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
// 创建一个表格的表头单元格
PdfPCell pdfTableHeaderCell = new PdfPCell();
// 设置表格的表头单元格颜色
pdfTableHeaderCell.setBackgroundColor(new BaseColor(240, 240, 240));
pdfTableHeaderCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
for (Column column : this.getColumns()) {
Paragraph item = new Paragraph(column.getName(), f8);
pdfTableHeaderCell.setPhrase(item);
pdfTable.addCell(pdfTableHeaderCell);
}
// 创建一个表格的正文内容单元格
PdfPCell pdfTableContentCell = new PdfPCell();
pdfTableContentCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
pdfTableContentCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
// 表格内容行数的填充
dataSet.first();
while (dataSet.fetch()) {
Record record = dataSet.getCurrent();
for (Column column : this.getColumns()) {
String field = column.getCode();
pdfTableContentCell.setPhrase(new Paragraph(record.getString(field), f8));
pdfTable.addCell(pdfTableContentCell);
}
}
document.add(pdfTable);
// //将表格添加到新的文档
// doc.add(table);
// //创建新的一页
// doc.newPage();
// //添加图片
// Image image = Image.getInstance(
// "https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png");
// //添加到文档
// doc.add(image);
// //设置对象方式
// image.setAlignment(Element.ALIGN_CENTER);
}
use of cn.cerc.jdb.core.Record in project summer-bean by cn-cerc.
the class IServiceProxy method delete.
// delete
public default boolean delete(Object... args) {
Record headIn = this.getDataIn().getHead();
headIn.setField("_method_", "delete");
return exec(args);
}
use of cn.cerc.jdb.core.Record in project summer-bean by cn-cerc.
the class IServiceProxy method post.
// append
public default boolean post(Object... args) {
Record headIn = this.getDataIn().getHead();
headIn.setField("_method_", "post");
return exec(args);
}
Aggregations