You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2016/04/14 19:57:44 UTC

[Bug 59327] New: Setting text direction on a table cell has no effect

https://bz.apache.org/bugzilla/show_bug.cgi?id=59327

            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
methods.

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");

        cell.setTextDirection(TextDirection.VERTICAL);

        FileOutputStream fos = new FileOutputStream(new File(outputFilePath));
        ppt.write(fos);
        ppt.close();
        fos.close();
    }

}

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


[Bug 59327] Setting text direction on a table cell has no effect

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59327

Andreas Beeker <ki...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|PC                          |All
            Version|3.14-FINAL                  |3.15-dev
                 OS|                            |All
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Andreas Beeker <ki...@apache.org> ---
Applied/fixed with r1742338
- added test
- added support for hslf

-- 
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