int x = text.getX() + offsetX; int y = text.getY() + offsetY; int width = text.getWidth(); int height = text.getHeight(); int topPadding = text.getLineBox().getTopPadding().intValue(); int leftPadding = text.getLineBox().getLeftPadding().intValue(); int bottomPadding = text.getLineBox().getBottomPadding().intValue(); int rightPadding = text.getLineBox().getRightPadding().intValue(); switch (text.getRotation()) y = text.getY() + offsetY + text.getHeight(); width = text.getHeight(); height = text.getWidth(); int tmpPadding = topPadding; topPadding = leftPadding; x = text.getX() + offsetX + text.getWidth(); width = text.getHeight(); height = text.getWidth(); int tmpPadding = topPadding; topPadding = rightPadding; x = text.getX() + offsetX + text.getWidth(); y = text.getY() + offsetY + text.getHeight(); topPadding = bottomPadding; bottomPadding = tmpPadding; if (text.getMode() == JRElement.MODE_OPAQUE)
protected String getTextFormatFactoryClass(JRPrintText text) { String formatFactoryClass = text.getFormatFactoryClass(); if (formatFactoryClass == null) { formatFactoryClass = jasperPrint.getFormatFactoryClass(); } return formatFactoryClass; }
/** * */ protected JRStyledText getStyledText(JRPrintText textElement) { return textElement.getFullStyledText(JRStyledTextAttributeSelector.NONE); }
public Map getStyledTextAttributes(JRPrintText printText) { Map attributes = new HashMap(); JRFontUtil.getAttributes(attributes, printText, getTextLocale(printText)); attributes.put(TextAttribute.FOREGROUND, printText.getForecolor()); if (printText.getMode() == JRElement.MODE_OPAQUE) { attributes.put(TextAttribute.BACKGROUND, printText.getBackcolor()); } return attributes; } };
horizontalAlignment = getHorizontalAlignment(text.getHorizontalAlignment(), text.getVerticalAlignment(), text.getRotation()); verticalAlignment = getVerticalAlignment(text.getHorizontalAlignment(), text.getVerticalAlignment(), text.getRotation()); switch(text.getRotation()) if (text.getRunDirection() == JRPrintText.RUN_DIRECTION_RTL)
/** * */ private Map getAttributes(JRStyle style) throws IOException//FIXMEDOCX put this in util? { JRPrintText text = new JRBasePrintText(null); text.setStyle(style); Map styledTextAttributes = new HashMap(); JRFontUtil.getAttributes(styledTextAttributes, text, (Locale)null);//FIXMEDOCX getLocale()); styledTextAttributes.put(TextAttribute.FOREGROUND, text.getForecolor()); if (text.getMode() == JRElement.MODE_OPAQUE) { styledTextAttributes.put(TextAttribute.BACKGROUND, text.getBackcolor()); } return styledTextAttributes; }
xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_textAlignment, text.getOwnHorizontalAlignment(), JRXmlConstants.getHorizontalAlignMap()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_verticalAlignment, text.getOwnVerticalAlignment(), JRXmlConstants.getVerticalAlignMap()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_textHeight, text.getTextHeight()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_rotation, text.getOwnRotation(), JRXmlConstants.getRotationMap()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_runDirection, text.getRunDirection(), JRXmlConstants.getRunDirectionMap(), JRPrintText.RUN_DIRECTION_LTR); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_lineSpacing, text.getOwnLineSpacing(), JRXmlConstants.getLineSpacingMap()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_markup, text.getOwnMarkup()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_lineSpacingFactor, text.getLineSpacingFactor()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_leadingOffset, text.getLeadingOffset()); xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkType, text.getLinkType()); xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkReference, text.getHyperlinkReference()); xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkAnchor, text.getHyperlinkAnchor()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkPage, text.getHyperlinkPage()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkTarget, text.getLinkTarget()); xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkTooltip, text.getHyperlinkTooltip()); xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_anchorName, text.getAnchorName()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_bookmarkLevel, text.getBookmarkLevel(), JRAnchor.NO_BOOKMARK); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_valueClass, text.getValueClassName()); xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_pattern, text.getPattern()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_formatFactoryClass, text.getFormatFactoryClass()); xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_locale, text.getLocaleCode()); xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_timezone, text.getTimeZoneId()); exportBox(text.getLineBox()); if (text.getOriginalText() != null)
int x = text.getX() + getOffsetX(); int y = text.getY() + getOffsetY(); int width = text.getWidth(); int height = text.getHeight(); int topPadding = text.getLineBox().getTopPadding().intValue(); int leftPadding = text.getLineBox().getLeftPadding().intValue(); int bottomPadding = text.getLineBox().getBottomPadding().intValue(); int rightPadding = text.getLineBox().getRightPadding().intValue(); switch (text.getRotation()) y = text.getY() + getOffsetY() + text.getHeight(); xFillCorrection = 1; width = text.getHeight(); height = text.getWidth(); int tmpPadding = topPadding; topPadding = leftPadding; x = text.getX() + getOffsetX() + text.getWidth(); yFillCorrection = -1; width = text.getHeight(); height = text.getWidth(); int tmpPadding = topPadding; topPadding = rightPadding; x = text.getX() + getOffsetX() + text.getWidth(); y = text.getY() + getOffsetY() + text.getHeight(); int tmpPadding = topPadding; topPadding = bottomPadding;
if (text.getAnchorName() != null) writer.write(text.getAnchorName()); writer.write("\"></a>"); if (text.getRunDirection() == JRPrintText.RUN_DIRECTION_RTL) appendSizeStyle(text, text, styleBuffer); appendBackcolorStyle(text, styleBuffer); appendBorderStyle(text.getLineBox(), styleBuffer); switch (text.getHorizontalAlignment()) switch (text.getVerticalAlignment()) styleBuffer.append("width: " + text.getWidth() + sizeUnit + "; "); styleBuffer.append("word-wrap: break-word; "); if (text.getLineSpacing() != JRTextElement.LINE_SPACING_SINGLE) styleBuffer.append("line-height: " + text.getLineSpacingFactor() + "; "); if (text.getLineBreakOffsets() != null) String textTooltip = hyperlinkStarted ? null : text.getHyperlinkTooltip(); exportStyledText(styledText, textTooltip);
JRStyledTextAttributeSelector.NO_BACKCOLOR.getStyledTextAttributes(printText), text, JRCommonText.MARKUP_STYLED_TEXT.equals(printText.getMarkup()),//FIXMEMARKUP only static styled text appears on preview. no other markup JRStyledTextAttributeSelector.getTextLocale(printText) ); false ); printText.setTextHeight(measuredText.getTextHeight() < printText.getHeight() ? measuredText.getTextHeight() : printText.getHeight()); printText.setLeadingOffset(measuredText.getLeadingOffset()); printText.setLineSpacingFactor(measuredText.getLineSpacingFactor()); if (JRCommonText.MARKUP_STYLED_TEXT.equals(printText.getMarkup())) printText.setText(printedText);
int rowCount = calculateYCoord(element.getHeight()); int columnCount = calculateXCoord(element.getWidth()); int x = calculateXCoord(element.getX() + getOffsetX()); int y = calculateYCoord(element.getY() + getOffsetY()); int yOffset = 0; if (element.getVerticalAlignment() == JRAlignment.VERTICAL_ALIGN_BOTTOM) yOffset = rowCount - rowIndex; if (element.getVerticalAlignment() == JRAlignment.VERTICAL_ALIGN_MIDDLE) yOffset = (rowCount - rowIndex) / 2; pos--; line = line.substring(0, pos + 1); if (element.getHorizontalAlignment() == JRAlignment.HORIZONTAL_ALIGN_RIGHT) xOffset = columnCount - line.length(); if (element.getHorizontalAlignment() == JRAlignment.HORIZONTAL_ALIGN_CENTER) xOffset = (columnCount - line.length()) / 2; if (element.getHorizontalAlignment() == JRAlignment.HORIZONTAL_ALIGN_JUSTIFIED) if (i < rowIndex -1) line = justifyText(line, columnCount);
+ " text:anchor-page-number=\"" + (pageIndex + 1) + "\"" + " draw:style-name=\"" + styleCache.getFrameStyle(text) + "\"" + " svg:x=\"" + Utility.translatePixelsToInches(text.getX()) + "in\"" + " svg:y=\"" + Utility.translatePixelsToInches(text.getY()) + "in\"" + " svg:width=\"" + Utility.translatePixelsToInches(text.getWidth()) + "in\"" + " svg:height=\"" + Utility.translatePixelsToInches(text.getHeight()) + "in\"" + "><draw:text-box>" );
short rotation = textElement.getRotation(); switch (textElement.getRotation()) switch (textElement.getHorizontalAlignment()) switch (textElement.getVerticalAlignment()) switch (textElement.getHorizontalAlignment()) switch (textElement.getVerticalAlignment()) default : horizontalAlignment = textElement.getHorizontalAlignment(); verticalAlignment = textElement.getVerticalAlignment();
Colour forecolor = getWorkbookColour(text.getForecolor()); WritableFont cellFont = this.getLoadedFont(text, forecolor.getValue()); if (customHandler == null) switch (text.getHyperlinkType()) href = text.getHyperlinkReference(); break;
private static void addTocHeading(Map<String, JasperTocHeading> headings, List<JasperTocHeading> headingList, JRPrintElement element, int pageNumber) { if (element instanceof JRPrintText && StringUtils.contains(element.getKey(), ".tocReference")) { String id = ((JRPrintText) element).getAnchorName(); JasperTocHeading heading = headings.get(id); heading.setPageIndex(pageNumber); headingList.add(heading); } if (element instanceof JRPrintFrame) { for (JRPrintElement element2 : ((JRPrintFrame) element).getElements()) { addTocHeading(headings, headingList, element2, pageNumber); } } }
/** * */ public void exportProps(JRStyle style) throws IOException { JRPrintText text = new JRBasePrintText(null); text.setStyle(style); Map styledTextAttributes = new HashMap(); JRFontUtil.getAttributes(styledTextAttributes, text, (Locale)null);//FIXMEDOCX getLocale()); styledTextAttributes.put(TextAttribute.FOREGROUND, text.getForecolor()); if (style.getMode() == null || style.getMode().byteValue() == JRElement.MODE_OPAQUE) { styledTextAttributes.put(TextAttribute.BACKGROUND, style.getBackcolor()); } exportProps(getAttributes(style.getStyle()), getAttributes(style)); }
public Map getStyledTextAttributes(JRPrintText printText) { Map attributes = new HashMap(); JRFontUtil.getAttributes(attributes, printText, getTextLocale(printText)); attributes.put(TextAttribute.FOREGROUND, printText.getForecolor()); return attributes; } };
int width = text.getWidth(); int height = text.getHeight(); int textHeight = (int)text.getTextHeight(); int topPadding = text.getLineBox().getTopPadding().intValue(); int leftPadding = text.getLineBox().getLeftPadding().intValue(); int bottomPadding = text.getLineBox().getBottomPadding().intValue(); int rightPadding = text.getLineBox().getRightPadding().intValue(); switch (text.getRotation()) switch (text.getVerticalAlignment()) switch (text.getVerticalAlignment()) switch (text.getVerticalAlignment()) switch (text.getVerticalAlignment()) if (text.getRunDirection() == JRPrintText.RUN_DIRECTION_RTL) writer.write(String.valueOf(getColorIndex(text.getBackcolor()))); writer.write(" "); switch (text.getHorizontalAlignment()) writer.write(String.valueOf(twip(text.getLineSpacingFactor() * font.getFontSize()))); writer.write(" ");
switch (text.getVerticalAlignment()) if (text.getRunDirection() == JRPrintText.RUN_DIRECTION_RTL) switch (text.getHorizontalAlignment()) (text.getRunDirection() == JRPrintText.RUN_DIRECTION_LTR && !horizontalAlignment.equals(CSS_TEXT_ALIGN_LEFT)) || (text.getRunDirection() == JRPrintText.RUN_DIRECTION_RTL && !horizontalAlignment.equals(CSS_TEXT_ALIGN_RIGHT)) if (text.getLineSpacing() != JRTextElement.LINE_SPACING_SINGLE) styleBuffer.append("line-height: " + text.getLineSpacingFactor() + "; "); if (text.getLineBreakOffsets() != null) if (text.getAnchorName() != null) writer.write(text.getAnchorName()); writer.write("\"/>"); String textTooltip = hyperlinkStarted ? null : text.getHyperlinkTooltip(); exportStyledText(styledText, textTooltip);
short rotation = textElement.getRotation(); switch (textElement.getRotation()) switch (textElement.getHorizontalAlignment()) switch (textElement.getVerticalAlignment()) switch (textElement.getHorizontalAlignment()) switch (textElement.getVerticalAlignment()) default : horizontalAlignment = textElement.getHorizontalAlignment(); verticalAlignment = textElement.getVerticalAlignment();