https://issues.apache.org/bugzilla/show_bug.cgi?id=52219

             Bug #: 52219
           Summary: XSSFTextBox cannot show font color and size
           Product: POI
           Version: 3.8-dev
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified


My Test File

import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.Drawing;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFColor;
import org.apache.poi.xssf.usermodel.XSSFDrawing;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFTextBox;

public class TestXSSFTextBox{
    public static void main(String[] args) throws IOException{
        Workbook wb = new XSSFWorkbook();
        Sheet sheet=wb.createSheet();
        Drawing drawing2 =sheet.createDrawingPatriarch();
        CreationHelper helper = wb.getCreationHelper();
        XSSFClientAnchor a1 = (XSSFClientAnchor) helper.createClientAnchor();
        a1.setRow1(0);
        a1.setRow2(5);
        a1.setCol1(0);
        a1.setCol2(5);

        XSSFTextBox textbox2 =((XSSFDrawing) drawing2).createTextbox(a1);
        XSSFRichTextString str = new XSSFRichTextString("Fontcolor is white!You
can not reset it!");
        XSSFFont font = (XSSFFont) wb.createFont();
        XSSFColor col=new XSSFColor(new java.awt.Color(0, 0, 255));
        font.setColor(col);
        font.setItalic(true);
        font.setFontName("sss");
        font.setBold(true);
        str.applyFont(font);
        textbox2.setText(str);
        textbox2.setNoFill(true);

        String file = "c:\\111.xlsx";
        FileOutputStream fileOut = new FileOutputStream(file);
        try{
            wb.write(fileOut);
        }finally{
            fileOut.close();
        }
    }
}

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to