poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 59327] New: Setting text direction on a table cell has no effect
Date Thu, 14 Apr 2016 17:57:44 GMT

            Bug ID: 59327
           Summary: Setting text direction on a table cell has no effect
           Product: POI
           Version: 3.14-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLF
          Assignee: dev@poi.apache.org
          Reporter: pelymtown@gmail.com

Created attachment 33764
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33764&action=edit
Version of XSLFTableCellclass with fixed version text direction getter/setter

Trying to set direction of a text inside a table cell by using
setTextDirection() method on the cell has no effect as text direction does not
change. Try the following code to reproduce the issue:

import java.awt.Rectangle;
import java.io.File;
import java.io.FileOutputStream;

import org.apache.poi.sl.usermodel.TextShape.TextDirection;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFTable;
import org.apache.poi.xslf.usermodel.XSLFTableCell;
import org.apache.poi.xslf.usermodel.XSLFTableRow;
import org.apache.poi.xslf.usermodel.XSLFTextParagraph;
import org.apache.poi.xslf.usermodel.XSLFTextRun;

public class TextDirectionTest {

    public static void main(String[] args) throws Exception {
        String outputFilePath = args[0];

        XMLSlideShow ppt = new XMLSlideShow(); 
        XSLFSlide slide = ppt.createSlide();

        XSLFTable tbl = slide.createTable();
        tbl.setAnchor(new Rectangle(50, 50, 200, 200));
        XSLFTableRow tr = tbl.addRow();

        XSLFTableCell cell = tr.addCell();
        XSLFTextParagraph p = cell.addNewTextParagraph();
        XSLFTextRun r = p.addNewTextRun();
        r.setText("Cell #1 vertical text");


        FileOutputStream fos = new FileOutputStream(new File(outputFilePath));


When the file produced by the above code is opened the direction of text is
still horizontal.

The issue can also be reproduced in v3.11 (where it was originally discovered).

In order to address the problem, default implementation(s) of text direction
getter/setter methods (from XSLFTextShape) need to be overridden in
XSLFTableCell class as demonstrated in the attached code.

You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message