You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by isfelly <is...@hotmail.com> on 2009/05/29 03:22:05 UTC

Create Table (PPT slide) with multi font

Hi all , i'm trying to create a table with different (fontName,size) but i
have a probleme anybody can help me ,i will attache two pic to describe this
probleme

http://www.nabble.com/file/p23772854/table.jpeg table.jpeg 

This is my code ...
private void createtable(){
///////////////////////////*********************************************///////
		try{
	    //table data              
	      String[][] data = {
	          {"Contact Client", "Client"},
	          {"Adresse", "xxxxx"},
	          {"E-mail", "xxxx@xxxx.xxx"},
	          {"Site internet", "xxxxx"},
	          {"Commentaire", "xxxxxxxxxxxxx"}
	      };
	      

	      SlideShow ppt = new SlideShow();

	      Slide slide = ppt.createSlide();
	      //create a table of 5 rows and 2 columns
	      Table table = new Table(5, 2);
	      for (int i = 0; i < data.length; i++) {
	          for (int j = 0; j < data[i].length; j++) {
	        	  //entete du tableau
	        	  if((i==0&&j==0)||(i==0&&j==1))
	        	  {
	              TableCell cell = table.getCell(i, j);
	              cell.setText(data[i][j]);
                  cell.setFillColor(new Color(231,188,41));
                  RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];
                  rt.setFontName("Vernada(Corps)");
	              rt.setFontSize(18);
	              cell.setVerticalAlignment(TextBox.AnchorMiddle);
	              cell.setHorizontalAlignment(TextBox.AlignCenter);
	          }
	        	  //ligne paire
	        	  if(i!=0&&i%2==0)
	        	  {
	              TableCell cell = table.getCell(i, j);
	              cell.setText(data[i][j]);
                  cell.setFillColor(new Color(250,244,232));
                  RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];
	              rt.setFontName("Vernada(Corps)");
	              rt.setFontSize(16);
	              cell.setVerticalAlignment(TextBox.AnchorMiddle);
	              cell.setHorizontalAlignment(TextBox.AlignCenter);
	          }
	        	  //ligne impaire
	        	  if(i!=0&&i%2!=0)
	        	  {
	              TableCell cell = table.getCell(i, j);
	              cell.setText(data[i][j]);
                  cell.setFillColor(new Color(246,231,205));
                  RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];
	              rt.setFontName("Vernada(Corps)");
	              rt.setFontSize(16);
	              cell.setVerticalAlignment(TextBox.AnchorMiddle);
	              cell.setHorizontalAlignment(TextBox.AlignCenter);
	          }
	        	  
	          }
	      }

	      //set table borders
	      Line border = table.createBorder();
	      border.setLineColor(Color.white);
	      border.setLineWidth(1.0);
	      table.setAllBorders(border);
	      

	      //set width of the 1st column
	      table.setColumnWidth(0, 300);
	      //set width of the 2nd column
	      table.setColumnWidth(1, 150);

	      slide.addShape(table);
	      table.moveTo(100, 100);
	      //Table tablecopy
=shapeGroupToTable((ShapeGroup)slideinputcopy.getShapes()[1]);
	      //table.setEscherProperty(tablecopy.getEscherProperty(propId), value)
tablecopy.get
	      
	      
	      FileOutputStream out = new FileOutputStream("c:\\hslf-table.ppt");
	      ppt.write(out);
	      out.close();
		}
-- 
View this message in context: http://www.nabble.com/Create-Table-%28PPT-slide%29-with-multi-font-tp23772854p23772854.html
Sent from the POI - User mailing list archive at Nabble.com.


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