java能不能做报表打印

yanxibang 2003-08-23 01:37:06
java能不能做报表打印?如何做?
...全文
87 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ewingchen 2003-08-23
  • 打赏
  • 举报
回复
使用报表工具,很多的
国外的象jreport、style report等等(不过价钱很贵)
我公司用的是国内的MingReport
cxl528 2003-08-23
  • 打赏
  • 举报
回复
c/s结构的不多,但B/S的非常流行!其实,JAVA的强项是server端!
yanxibang 2003-08-23
  • 打赏
  • 举报
回复
我回去研究一下太谢谢你了,大哥!外面用java开发数据库的多不多(c/s结构)?
cxl528 2003-08-23
  • 打赏
  • 举报
回复
只要能import style report的打印类,用什么IDE工具都是一样的!

我贴一部分代码给你看看就明白了!

public class Mailing {
public static void main(String[] args) {
ReportSheet report = createReport();
PreviewView previewer = new Previewer();
previewer.setExitOnClose(true);
previewer.print(report);
previewer.pack();
previewer.setVisible(true);
}
public static ReportSheet createReport() {
ReportSheet report = new StyleSheet();
StyleSheet layout = (StyleSheet)report;
Vector areas = new Vector();
for(int i = 0; i < labels.length; i++) {
FixedContainer label = new FixedContainer(report);
label.addText(labels[i][0], new Rectangle(5, 5, 120, 15));
label.addText(labels[i][1], new Rectangle(5, 20, 120, 15));
label.addText(labels[i][2], new Rectangle(5, 35, 120, 15));
label.addText(labels[i][3], new Rectangle(5, 50, 60, 15));
label.addText(labels[i][4], new Rectangle(65, 50, 20, 15));
label.addText(labels[i][5], new Rectangle(85, 50, 100, 15));
PageArea area = new PageArea((i % 2) * 3.2, (i / 2) * 1.2, 3.2, 1.2);
area.setElements(label);
areas.addElement(area);
}
PageArea[] arr = new PageArea[areas.size()];
areas.copyInto(arr);
layout.setPageLayout(new PageLayout(arr));
return report;
}
static String[][] labels = {
{"John Who", "123 Main Stree", "Suite 100", "NewTown", "UN", "12345"},
Page 73 of 305
STYLE REPORT PROGRAMMING GUIDE {"Thomas Who", "123 Second Stree", "", "NewTown", "UN", "12345"},
{"Alex Who", "123 2rd Avenue", "Suite 100", "NewTown", "UN", "12345"},
{"Tammy Who", "123 Broadway", "Floor 23", "NewTown", "UN", "12345"},
{"Mary Who", "123 Valley Road", "", "NewTown", "UN", "12345"},
{"Alice Who", "123 Park Ave", "Suite 101", "NewTown", "UN", "12345"},
{"Larry Who", "123 Queens Blvd", "Room 100", "NewTown", "UN", "12345"},
{"Susan Who", "123 Madison Ave", "Suite 100", "NewTown", "UN", "12345"},
};
}
yanxibang 2003-08-23
  • 打赏
  • 举报
回复
我用的是javapad,用代码写能做到吗?
cxl528 2003-08-23
  • 打赏
  • 举报
回复
style report能与jbuilder结合得很好,其他的工具我就不清楚了,你去下载一个试用版本用用就知道了,安装完以后,在开始菜单里有帮助文档的,很详细,强烈推荐!!!:)
yanxibang 2003-08-23
  • 打赏
  • 举报
回复
是jbuild中的吗?能不能给代码
cxl528 2003-08-23
  • 打赏
  • 举报
回复
当然可以,报表工具很多的,jreport、style report等等!

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧