1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| package com.esisa.mvc2.model;
/**
*
*/
import java.awt.Color;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import com.lowagie.text.*;
import com.lowagie.text.rtf.RtfWriter2;
/**
* @author Lopez Thomas
*
*/
public class main {
/**
* @param args
*/
public void main() {
// TODO Auto-generated method stub
String[] data=null;
String fileo = "test.txt";
System.out.println("jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
try{
fileo = "C:/med.doc";
}catch(Exception e){
}
System.out.println(makepdf(data,"test"));
}
private static String makepdf(String[] datapdf,String file) {
// TODO Auto-generated method stub
String output="generation reussie";
Document document = new Document();
try {
RtfWriter2.getInstance(document, new FileOutputStream("./"+file+".doc"));
document.open();
int i=0;
/*changer la font
* RtfFont rtfFont = new RtfFont("Comic Sans MS");
* Paragraph para = new Paragraph("This is a paragraph in Comic Sans MS", rtfFont);
* */
document.add(new Paragraph("Some more text on the first page with different color and font type.", FontFactory.getFont(FontFactory.COURIER, 14, Font.BOLD, new Color(255, 150, 200))));
} catch (DocumentException de) {
output = "generation pas reussie " ;
System.err.println(de.getMessage());
} catch (IOException ioe) {
output = "generation pas reussie exception" ;
System.err.println(ioe.getMessage());
}
document.close();
return output;
}
} |
Partager