栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

WAGU(表格视图中的数据)库中的修改

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

WAGU(表格视图中的数据)库中的修改

最终,我花了一整夜的时间编写代码:)好,感谢Clough先生提供的WAGU示例。

我的代码如下:

String company = "" + "V.K Autos Larkanan" + "Near Rehmaniya Masjid Larkanan" + "Police Shopping Center Larkanan" + "Cell: 0334-3269198, 0333-3910951n" + " n" + "CUSTOMER INVOICE" + " ";    Calendar cal = Calendar.getInstance();    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");    List<String> t1Headers = Arrays.asList("INFO", "CUSTOMER");    List<List<String>> t1Rows = Arrays.asList( Arrays.asList("DATE: " + date + "", "" + txt_cnam.getText()), Arrays.asList("TIME: " + sdf.format(cal.getTime()) + "", "Bill No:" + billno + "")    );    String t2Desc = "SELLING DETAILS";    List<String> t2Headers = Arrays.asList("ITEM", "QTY", "Rate", "Total");    List<List<String>> t2Rows = new ArrayList<List<String>>();    for (int i = 0; i < tbl_sale.getRowCount(); i++) {        String pid = tbl_sale.getValueAt(i, 0).toString();        String item = tbl_sale.getValueAt(i, 1).toString();        String quant = tbl_sale.getValueAt(i, 2).toString();        String rate = tbl_sale.getValueAt(i, 3).toString();        String rs = tbl_sale.getValueAt(i, 4).toString();        ArrayList<String> temp = new ArrayList<String>();        temp.add(item);        temp.add(quant);        temp.add(rate);        temp.add(rs);        t2Rows.add(temp);    }    List<Integer> t2ColWidths = Arrays.asList(16, 5, 7, 9);    String t3Desc = "Sub Total";    List<String> t3Headers = Arrays.asList("", "", "", "");    List<List<String>> t3Rows = Arrays.asList( Arrays.asList("WR-DVD", "122.00", "7", "854.00")    );    String summary = "" + "Sub Totaln";    String summaryVal = "" + txt_total.getText() + "n";    String sign1 = "" +"------Thank you for your visit------n";    String sign2 = "" + "-We value your visit-n";    String advertise = "******** Soulution by AbroSoft *******n* abrosoft@outlook.com # 03337584273 *";    try {        Board b = new Board(48);        b.setInitialBlock(new Block(b, 40, 6, company).allowGrid(true).setBlockAlign(Block.BLOCK_LEFT).setDataAlign(Block.DATA_CENTER));        b.appendTableTo(0, Board.APPEND_BELOW, new Table(b, 42, t1Headers, t1Rows));        b.getBlock(3).setBelowBlock(new Block(b, 40, 1, t2Desc).setDataAlign(Block.DATA_CENTER));        b.appendTableTo(5, Board.APPEND_BELOW, new Table(b, 40, t2Headers, t2Rows, t2ColWidths));        Block summaryBlock = new Block(b, 30, 1, summary).setDataAlign(Block.DATA_TOP_RIGHT);        b.getBlock(10).setBelowBlock(summaryBlock);        Block summaryValBlock = new Block(b, 9, 1, summaryVal).setDataAlign(Block.DATA_TOP_RIGHT);        summaryBlock.setRightBlock(summaryValBlock);        Block sign1Block = new Block(b, 40, 1, sign1).setDataAlign(Block.DATA_CENTER);        b.getBlock(14).setBelowBlock(sign1Block);        Block sign2Block = new Block(b, 40, 2, advertise).setDataAlign(Block.DATA_CENTER);        b.getBlock(16).setBelowBlock(sign2Block);        System.out.println(b.invalidate().build().getPreview());

现在的输出就像我需要的:)。输出如下:

  +----------------------------------------+        | V.K Autos Larkana|        |      Near Rehmaniya Masjid Larkana     |        |     Police Shopping Center Larkana     |        |    Cell: 0334-3269198, 0333-3910951    |        |       |        | CUSTOMER INVOICE |        +--------------------+-------------------+        |INFO     |CUSTOMER|        +--------------------+-------------------+        |DATE: 2016/01/28    |Mohammad Rafi Abro |        |TIME: 15:31:15      |Bill No:10         |        +--------------------+-------------------+        |  SELLING DETAILS |        +----------------+-----+-------+---------+        |ITEM |  QTY|   Rate|    Total|        +----------------+-----+-------+---------+        |nuts |   12|     25|      300|        |70 CC|   12|   7000|    84000|        |125 CC          |   13|  95000|  1235000|        |12   |   25|   2500|    62500|        +----------------+-----+-------+---------+        |          Sub Total|  1381800|        +------------------------------+---------+        |  ------Thank you for your visit------  |        +----------------------------------------+        | ******** Soulution by AbroSoft ******* |        | * abrosoft@outlook.com # 03337584273 * |        +----------------------------------------+

好吧,再次感谢



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/440639.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号