https://issues.apache.org/bugzilla/show_bug.cgi?id=45633
Summary: PPT Table problem
Product: POI
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P1
Component: HSLF
AssignedTo: dev@poi.apache.org
ReportedBy: cvolozhin@pragmaticsoft.com
Created an attachment (id=22447)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=22447)
PPT file
Wrong table cells position in slide. Relative to slide coorditates, not to
table. POI code taken from SVN trunk a couple days ago.
Code snippet here:
import java.io.*;
import org.apache.poi.hslf.model.*;
import org.apache.poi.hslf.usermodel.*;
public class JustPOI {
public static void main(String[] args) {
SlideShow ppt = null;
try {
ppt = new SlideShow(new FileInputStream("PST.ppt"));
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
Slide slide = ppt.getSlides()[0];
Shape shape = slide.getShapes()[2];
// Create table data array
String[] row1 = new String[3];
row1[0] = "Project Name";
row1[1] = "ProjectID";
row1[2] = "Priority";
String[] row2 = new String[3];
row2[0] = "Test Work";
row2[1] = "-";
row2[2] = "-";
String[][] tableData = new String[2][3];
tableData[0] = row1;
tableData[1] = row2;
Table pptTable = new Table(2, 3);
for (int i = 0; i < pptTable.getNumberOfRows(); i++) {
String[] rowData = tableData[i];
for (int j = 0; j < pptTable.getNumberOfColumns(); j++) {
TableCell pptCell = pptTable.getCell(i, j);
String cellData = rowData[j];
if (cellData != null) {
pptCell.setText(cellData);
RichTextRun rt =
pptCell.getTextRun().getRichTextRuns()[0];
rt.setFontName("Arial");
rt.setFontSize(10);
}
}
}
pptTable.setAnchor(shape.getAnchor());
slide.removeShape(shape);
slide.addShape(pptTable);
try {
ppt.write(new FileOutputStream("PST_out.ppt"));
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
}
}
--
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
|