Package com.lowagie.text.rtf.table

Examples of com.lowagie.text.rtf.table.RtfCell


  {
    final Dimension dimension = table.getDimension();
    if (x + cs > dimension.width) throw new IllegalStateException();
    if (y + rs > dimension.height) throw new IllegalStateException();

    Cell cell = new RtfCell();
    cell.setColspan(cs);
    cell.setRowspan(rs);
    table.addCell(cell, y, x);

    for (int col = 0; col < cs; col++)
    {
      for (int row = 0; row < rs; row++)
View Full Code Here


            final CellBackground background = cellBackgroundProducer.getBackgroundAt
                (logicalPage, sheetLayout, col, row, false, sectionType);
            if (background == null)
            {
              // An empty cell .. ignore
              final RtfCell cell = new RtfCell();
              cell.setBorderWidth(0);
              table.addCell(cell, row, col);
              continue;
            }

            // A empty cell with a defined background ..
            final RtfCell cell = new RtfCell();
            cell.setBorderWidth(0);
            updateCellStyle(cell, background);
            table.addCell(cell, row, col);
            continue;
          }

          if (content.isCommited() == false)
          {
            throw new InvalidReportStateException("Uncommited content encountered");
          }

          final long contentOffset = contentProducer.getContentOffset(row, col);
          final long colPos = sheetLayout.getXPosition(col);
          final long rowPos = sheetLayout.getYPosition(row);
          if (content.getX() != colPos || (content.getY() + contentOffset) != rowPos)
          {
            // A spanned cell ..
            continue;
          }

          final int colSpan = sheetLayout.getColSpan(col, content.getX() + content.getWidth());
          final int rowSpan = sheetLayout.getRowSpan(row, content.getY() + content.getHeight() + contentOffset);

          final CellBackground realBackground = cellBackgroundProducer.getBackgroundAt
              (logicalPage, sheetLayout, col, row, colSpan, rowSpan, false, sectionType);

          final Cell cell = new Cell();
          cell.setRowspan(rowSpan);
          cell.setColspan(colSpan);
          cell.setBorderWidth(0);
          // Sadly RTF-Cell does not provide a setter for the row-span. Therefore we have to "import" a plain cell
          // for that. The design of the iText RTF writer seems to be seriously flawed here ..
          if (realBackground != null)
          {
            updateCellStyle(cell, realBackground);
View Full Code Here

           
            document.add(new RtfTOCEntry("Cell border demonstration"));

            Table table = new Table(3);

            RtfCell cellDotted = new RtfCell("Dotted border");
            cellDotted.setBorders(new RtfBorderGroup(LwgRectangle.BOX, RtfBorder.BORDER_DOTTED, 1, new Color(0, 0, 0)));
            RtfCell cellEmbossed = new RtfCell("Embossed border");
            cellEmbossed.setBorders(new RtfBorderGroup(LwgRectangle.BOX, RtfBorder.BORDER_EMBOSS, 1, new Color(0, 0, 0)));
            RtfCell cellNoBorder = new RtfCell("No border");
            cellNoBorder.setBorders(new RtfBorderGroup());
           
            table.addCell(cellDotted);
            table.addCell(cellEmbossed);
            table.addCell(cellNoBorder);
           
View Full Code Here

            cellSpanHorizVert.setRowspan(2);
            table.addCell(emptyCell);
            table.addCell(cellSpanHorizVert);
            table.addCell(emptyCell);

            RtfCell cellDotted = new RtfCell("Dotted border");
            cellDotted.setBorders(new RtfBorderGroup(LwgRectangle.BOX,
                    RtfBorder.BORDER_DOTTED, 1, new Color(0, 0, 0)));
            RtfCell cellEmbossed = new RtfCell("Embossed border");
            cellEmbossed.setBorders(new RtfBorderGroup(LwgRectangle.BOX,
                    RtfBorder.BORDER_EMBOSS, 1, new Color(0, 0, 0)));
            RtfCell cellNoBorder = new RtfCell("No border");
            cellNoBorder.setBorders(new RtfBorderGroup());

            table.addCell(cellDotted);
            table.addCell(cellEmbossed);
            table.addCell(cellNoBorder);
View Full Code Here

            document.open();
           
            Table table = new Table(3);

            // Create a simple RtfCell with a dotted border.
            RtfCell cellDotted = new RtfCell("Dotted border");
            cellDotted.setBorders(new RtfBorderGroup(LwgRectangle.BOX,
                    RtfBorder.BORDER_DOTTED, 1, new Color(0, 0, 0)));
           
            // Create a simple RtfCell with an embossed border.
            RtfCell cellEmbossed = new RtfCell("Embossed border");
            cellEmbossed.setBorders(new RtfBorderGroup(LwgRectangle.BOX,
                    RtfBorder.BORDER_EMBOSS, 1, new Color(0, 0, 0)));
           
            // Create a simple RtfCell with no border.
            RtfCell cellNoBorder = new RtfCell("No border");
            cellNoBorder.setBorders(new RtfBorderGroup());
            cellNoBorder.setRowspan(2);
           
            // Create a simple RtfCell that only has a border
            // on the bottom side.
            RtfCell bottomBorder = new RtfCell("Bottom border");
            bottomBorder.setBorders(new RtfBorderGroup(LwgRectangle.BOTTOM,
                    RtfBorder.BORDER_SINGLE, 2, new Color(255, 0, 0)));
           
            // Create a simple RtfCell that has different borders
            // on the left and bottom sides.
            RtfCell mixedBorder = new RtfCell("Mixed border");
            RtfBorderGroup mixedBorders = new RtfBorderGroup();
            mixedBorders.addBorder(LwgRectangle.RIGHT,
                    RtfBorder.BORDER_DOUBLE_WAVY, 2, Color.GREEN);
            mixedBorders.addBorder(LwgRectangle.BOTTOM,
                    RtfBorder.BORDER_DOT_DASH, 1, Color.BLUE);
            mixedBorder.setBorders(mixedBorders);
           
            // Add the cells to the table
            table.addCell(cellDotted);
            table.addCell(cellEmbossed);
            table.addCell(cellNoBorder);
View Full Code Here

            Paragraph title = new Paragraph();
            title.add(new Chunk(uc.getUseCaseName().trim()));
            title.setAlignment(1);
            document.add(title);

            RtfCell useCaseID = new RtfCell("用况编号:");
            useCaseID.setBorders(normal);

            RtfCell useCaseIDC = new RtfCell(uc.getUseCaseId()
                .toString());
            useCaseIDC.setBorders(normal);

            RtfCell useCaseName = new RtfCell("用况名称:");
            useCaseName.setBorders(normal);

            RtfCell useCaseNameC = new RtfCell(uc.getUseCaseName());
            useCaseNameC.setBorders(normal);

            RtfCell useCaseDescription = new RtfCell("用况描述:");
            useCaseDescription.setBorders(normal);

            RtfCell useCaseDescriptionC = new RtfCell(uc
                .getUseCaseDescription());
            useCaseDescriptionC.setBorders(normal);

            RtfCell useCasePriority = new RtfCell("用况优先级:");
            useCasePriority.setBorders(normal);

            RtfCell useCasePriorityC = null;

            if (uc.getUseCasePriority() != null) {
              useCasePriorityC = new RtfCell(uc
                  .getUseCasePriority().toString());
            } else {
              useCasePriorityC = new RtfCell("");
            }

            useCasePriorityC.setBorders(normal);

            RtfCell specialRequirement = new RtfCell("特殊要求:");
            specialRequirement.setBorders(normal);

            RtfCell specialRequirementC = new RtfCell(uc
                .getUseCaseSpecialRequirement());
            specialRequirementC.setColspan(3);
            specialRequirementC.setBorders(normal);

            RtfCell preCondition = new RtfCell("前置条件:");
            preCondition.setBorders(normal);

            RtfCell preConditionC = new RtfCell(uc
                .getUseCasePreconditions());
            preConditionC.setColspan(3);
            preConditionC.setBorders(normal);

            RtfCell fireCondition = new RtfCell("触发条件:");
            fireCondition.setBorders(normal);

            RtfCell fireConditionC = new RtfCell(uc
                .getUseCaseTrigger());
            fireConditionC.setColspan(3);
            fireConditionC.setBorders(normal);

            RtfCell postCondition = new RtfCell("后置条件:");
            postCondition.setBorders(normal);

            RtfCell postConditionC = new RtfCell(uc
                .getUseCasePostConditions());
            postConditionC.setColspan(3);
            postConditionC.setBorders(normal);

            RtfCell failedEndCondition = new RtfCell("失败情况:");
            failedEndCondition.setBorders(normal);

            RtfCell failedEndConditionC = new RtfCell(uc
                .getUseCaseFailedEndCondition());
            failedEndConditionC.setColspan(3);
            failedEndConditionC.setBorders(normal);

            Table table = new Table(4);
            table.addCell(useCaseID);
            table.addCell(useCaseIDC);
            table.addCell(useCaseName);
            table.addCell(useCaseNameC);
            table.addCell(useCaseDescription);
            table.addCell(useCaseDescriptionC);
            table.addCell(useCasePriority);
            table.addCell(useCasePriorityC);
           
            table.addCell(fireCondition);
            table.addCell(fireConditionC);
            table.addCell(preCondition);
            table.addCell(preConditionC);
            table.addCell(failedEndCondition);
            table.addCell(failedEndConditionC);
            table.addCell(postCondition);
            table.addCell(postConditionC);         
            table.addCell(specialRequirement);
            table.addCell(specialRequirementC);

            // 生成Use Case具体描述的标题

            RtfCell userOperation = new RtfCell("用户操作");
            userOperation.setBorders(normal);

            RtfCell systemOperation = new RtfCell("系统操作");
            systemOperation.setBorders(normal);

            RtfCell systemOutput = new RtfCell("系统输出");
            systemOutput.setBorders(normal);

            Table table2 = new Table(3);
            table2.addCell(userOperation);
            table2.addCell(systemOperation);
            table2.addCell(systemOutput);

            // 生成Use Case具体描述的内容
            ArrayList ucis = new ArrayList();

            UseCaseInteraction uci = new UseCaseInteraction();
            uci.setUseCaseId(uc.getUseCaseId());
            OrderRule orderule = new OrderRule();
            orderule.setOrderColumn("sequence");
            orderule.setOrderDirection(OrderDirection.ASC);
            OrderRule[] orderRules = { orderule };
            String temp;
            ucis = cdp.query(uci, orderRules);
            if (ucis.size() > 0) {
              for (int k = 0; k < ucis.size(); k++) {
                temp = ((UseCaseInteraction) ucis.get(k))
                    .getOperatorAction();
                temp = removeHtml(temp);
                RtfCell userOperationC = new RtfCell(temp);
                userOperationC.setBorders(normal);

                temp = ((UseCaseInteraction) ucis.get(k))
                    .getSystemAction();
                temp = removeHtml(temp);
                RtfCell systemOperationC = new RtfCell(temp);
                systemOperationC.setBorders(normal);

                temp = ((UseCaseInteraction) ucis.get(k))
                    .getSystemOutput();
                temp = removeHtml(temp);
                RtfCell systemOutputC = new RtfCell(temp);
                systemOutputC.setBorders(normal);
                table2.addCell(userOperationC);
                table2.addCell(systemOperationC);
                table2.addCell(systemOutputC);
              }
View Full Code Here

            document.open();
           
            Table table = new Table(3);

            // Create a simple RtfCell with a dotted border.
            RtfCell cellDotted = new RtfCell("Dotted border");
            cellDotted.setBorders(new RtfBorderGroup(Rectangle.BOX,
                    RtfBorder.BORDER_DOTTED, 1, new Color(0, 0, 0)));
           
            // Create a simple RtfCell with an embossed border.
            RtfCell cellEmbossed = new RtfCell("Embossed border");
            cellEmbossed.setBorders(new RtfBorderGroup(Rectangle.BOX,
                    RtfBorder.BORDER_EMBOSS, 1, new Color(0, 0, 0)));
           
            // Create a simple RtfCell with no border.
            RtfCell cellNoBorder = new RtfCell("No border");
            cellNoBorder.setBorders(new RtfBorderGroup());
            cellNoBorder.setRowspan(2);
           
            // Create a simple RtfCell that only has a border
            // on the bottom side.
            RtfCell bottomBorder = new RtfCell("Bottom border");
            bottomBorder.setBorders(new RtfBorderGroup(Rectangle.BOTTOM,
                    RtfBorder.BORDER_SINGLE, 2, new Color(255, 0, 0)));
           
            // Create a simple RtfCell that has different borders
            // on the left and bottom sides.
            RtfCell mixedBorder = new RtfCell("Mixed border");
            RtfBorderGroup mixedBorders = new RtfBorderGroup();
            mixedBorders.addBorder(Rectangle.RIGHT,
                    RtfBorder.BORDER_DOUBLE_WAVY, 2, Color.GREEN);
            mixedBorders.addBorder(Rectangle.BOTTOM,
                    RtfBorder.BORDER_DOT_DASH, 1, Color.BLUE);
            mixedBorder.setBorders(mixedBorders);
           
            // Add the cells to the table
            table.addCell(cellDotted);
            table.addCell(cellEmbossed);
            table.addCell(cellNoBorder);
View Full Code Here

            cellSpanHorizVert.setRowspan(2);
            table.addCell(emptyCell);
            table.addCell(cellSpanHorizVert);
            table.addCell(emptyCell);

            RtfCell cellDotted = new RtfCell("Dotted border");
            cellDotted.setBorders(new RtfBorderGroup(Rectangle.BOX,
                    RtfBorder.BORDER_DOTTED, 1, new Color(0, 0, 0)));
            RtfCell cellEmbossed = new RtfCell("Embossed border");
            cellEmbossed.setBorders(new RtfBorderGroup(Rectangle.BOX,
                    RtfBorder.BORDER_EMBOSS, 1, new Color(0, 0, 0)));
            RtfCell cellNoBorder = new RtfCell("No border");
            cellNoBorder.setBorders(new RtfBorderGroup());

            table.addCell(cellDotted);
            table.addCell(cellEmbossed);
            table.addCell(cellNoBorder);
View Full Code Here

           
            document.add(new RtfTOCEntry("Cell border demonstration"));

            Table table = new Table(3);

            RtfCell cellDotted = new RtfCell("Dotted border");
            cellDotted.setBorders(new RtfBorderGroup(Rectangle.BOX, RtfBorder.BORDER_DOTTED, 1, new Color(0, 0, 0)));
            RtfCell cellEmbossed = new RtfCell("Embossed border");
            cellEmbossed.setBorders(new RtfBorderGroup(Rectangle.BOX, RtfBorder.BORDER_EMBOSS, 1, new Color(0, 0, 0)));
            RtfCell cellNoBorder = new RtfCell("No border");
            cellNoBorder.setBorders(new RtfBorderGroup());
           
            table.addCell(cellDotted);
            table.addCell(cellEmbossed);
            table.addCell(cellNoBorder);
           
View Full Code Here

TOP

Related Classes of com.lowagie.text.rtf.table.RtfCell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.