html to pdf not showing images from image folder - java

i am creating a .jar file to plug into a java connector on bpm.
the idea is for the .jar to generate a pdf from html which is using images from a Image folder and send as an email attachment.
the PDF sends ok with the html and the images when ran from eclipse, soon as i export the .jar and try to use it outside of eclipse it doesnt show the images
System.out.println("I am about to get resource image001");
BufferedImage imageone = ImageIO.read(new FileInputStream("Images/image001.jpg"));
File outputfile = new File("Images/image001.jpg");
ImageIO.write(imageone, "jpg", outputfile);
System.out.println("image 1 " + outputfile.toURL());
String one = "Images/image001.jpg";
System.out.println("got image 1");
System.out.println("I am about to get rousrce image002");
//BufferedImage bufferedImage2 = ImageIO.read(jamesNew.class.getResource("/Images/image002.gif"));
BufferedImage imagwtwo = ImageIO.read(new FileInputStream("Images/image002.gif"));
File outputfile1 = new File("image002.gif");
ImageIO.write(imagwtwo, "gif", outputfile1);
System.out.println("image 2 " + outputfile1.toURL());
String two = "Images/image002.gif";
System.out.println("got image 2");
System.out.println("I am about to get rousrce image003");
//BufferedImage bufferedImage3 = ImageIO.read(jamesNew.class.getResource("/Images/image003.gif"));
BufferedImage imagwthree = ImageIO.read(new FileInputStream("Images/image003.gif"));
File outputfile2 = new File("image003.gif");
ImageIO.write(imagwthree, "gif", outputfile2);
System.out.println("image 3 " + outputfile2.toURL());
String three = "Images/image003.gif";
System.out.println("got image 3");
System.out.println("I am about to get rousrce image004");
//BufferedImage bufferedImage4 = ImageIO.read(jamesNew.class.getResource("/Images/image006.gif"));
BufferedImage imagefour = ImageIO.read(new FileInputStream("Images/image006.gif"));
File outputfile3 = new File("image006.gif");
ImageIO.write(imagefour, "gif", outputfile3);
System.out.println("image 4 " + outputfile3.toURL());
String four = "Images/image006.gif";
System.out.println("got image 4");
System.out.println("I am about to get rousrce image005");
//BufferedImage bufferedImage5 = ImageIO.read(jamesNew.class.getResource("/Images/logo1.png"));
BufferedImage imagwfive = ImageIO.read(new FileInputStream("Images/logo1.png"));
File outputfile4 = new File("logo1.png");
ImageIO.write(imagwfive, "png", outputfile4);
System.out.println("image 5 " + outputfile4.toURL());
String five = "Images/logo1.png";
System.out.println("got image 5");
System.out.println("CLASS PATHS SET..........");
String named = null;
String total = null;
String completehtml1 = null;
String style = "<style type=\""+"text/css" + "\" >" + ".centerImage { text-align:center; display:block; } </style>";
String feed = "<html><body>";
System.out.println("STRINGS SET..........");
completehtml = feed + style + "<div style=\"text-align:center;\">" + "<img src=\"" + outputfile + "\" />" + "<p></p>" + "<img src=\"" + outputfile1 + "\" + style=\"width:400px;height:150px;" + "\" />" + "<p><h3 style=\"text-align:center;"+"\">" + "THIS IS TO CERTIFY" + "</h3></p>" + "<p><h3 style=\"text-align:center;"+"\">"+ user + "</h3></p>" + "<p>" + "</p>" + "<p>" + "<img src=\"" + outputfile2 + "\" />" + "</p>" + "<p>" + "</p>" + "<p><h3 style=\"text-align:center;"+"\">"+ dateTXT + " " + date + "</h3></p>" + "<p><h3 style=\"text-align:center;"+"\">" + "SIGNED" + "</h3></p>" + "<p>" + "</p>" + "<p>" + "<img src=\"" + outputfile3 + "\" + style=\"width:150px;height:150px;"+"\" />" + "</p>" + "<p>" + "</p>" + "<p>" + "<img src=\"" + outputfile4 + "\" />" + "</p>" + "<p></p>" + "<p></p>" + "</div>" + htmlend;
total = completehtml + named + completehtml1 + htmlend;
System.out.println("complete HTML" + completehtml);
System.out.println("STARTED!!!");
ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
ObjectOutputStream file = new ObjectOutputStream(baos1);
Document document = new Document();
PdfWriter pdfwriter = PdfWriter.getInstance(document, baos1);
document.open();
System.out.println("DOCUMENT OPEN");
document.addAuthor("James Parish");
XMLWorkerHelper worker = XMLWorkerHelper.getInstance();
worker.parseXHtml(pdfwriter, document, new StringReader(completehtml));
// worker.parseXHtml(pdfwriter, document, new FileInputStream("Images/image001.jpg"));
System.out.println("NEW PARAGRAPH");
System.out.println("PARAGRAPH ADDED");
document.close();
System.out.println("CLOSED DOCUMENT!");
file.close();
System.out.println("CLOSED FILE");
System.out.println("pdf is" + file);
System.out.println("ENDED!!!");
Email from = new Email(msgfrom);
Email to = new Email(msgto);
Content content = new Content("text/plain", msgbody);
Mail mail = new Mail(from, subject, to, content);
ByteArrayOutputStream fileData = null;
byte[] testing = baos1.toByteArray();
try {
fileData = baos1;
Attachments attachments3 = new Attachments();
Base64 x = new Base64();
String imageDataString = Base64.encodeBase64String(testing);
attachments3.setContent(imageDataString);
attachments3.setType("application/pdf");//"application/pdf"
attachments3.setFilename("Certificate.pdf");
attachments3.setDisposition("attachment");
attachments3.setContentId("Banner");
mail.addAttachments(attachments3);
System.out.println("BASE64 ENCODED ATTACHMENT " + imageDataString);

Related

JAVA, How can I edit the text inside a node, in xml?

so let's say I have the current XML file.
<?xml version="1.0" encoding="UTF-8"?>
<config>
<apps>
<app name="app1">
<url>someUrl</url>
<username>user1</username>
<password>qwerty123</password>
</app>
<app name="app2">
<url>someUrl</url>
<username>user2</username>
<password>asdasdasd</password>
</app>
<app name="app3">
<url>someUrl</url>
<username>user3</username>
<password>123456789</password>
</app>
</apps>
</config>
I've searched far and wide on how to edit the first password (qwerty123) to something else and then save the file, but I just can't find the proper solution.
Does anyone here have an idea on how can I do that?
Example solution with DOM parser:
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<config>\n" +
" <apps>\n" +
" <app name=\"app1\">\n" +
" <url>someUrl</url>\n" +
" <username>user1</username>\n" +
" <password>qwerty123</password>\n" +
" </app>\n" +
" <app name=\"app2\">\n" +
" <url>someUrl</url>\n" +
" <username>user2</username>\n" +
" <password>asdasdasd</password>\n" +
" </app>\n" +
" <app name=\"app3\">\n" +
" <url>someUrl</url>\n" +
" <username>user3</username>\n" +
" <password>123456789</password>\n" +
" </app>\n" +
" </apps>\n" +
"</config>";
//here use your InputStream for example from file
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(inputStream);
doc.getDocumentElement().normalize();
doc.getElementsByTagName("password").item(0).getFirstChild().setNodeValue("new content");
//here use your outputStream for example file output stream
OutputStream outputStream = new ByteArrayOutputStream();
Source xmlSource = new DOMSource(doc);
Result outputTarget = new StreamResult(outputStream);
TransformerFactory.newInstance().newTransformer()
.transform(xmlSource, outputTarget);
//when you replace output stream with file output stream remove this, as this line is only for debugging
System.out.println(new String(((ByteArrayOutputStream) outputStream).toByteArray()));
Maybe you can do that:
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
"<config>\r\n" +
" <apps>\r\n" +
" <app name=\"app1\">\r\n" +
" <url>someUrl</url>\r\n" +
" <username>user1</username>\r\n" +
" <password>qwerty123</password>\r\n" +
" </app>\r\n" +
" <app name=\"app2\">\r\n" +
" <url>someUrl</url>\r\n" +
" <username>user2</username>\r\n" +
" <password>asdasdasd</password>\r\n" +
" </app>\r\n" +
" <app name=\"app3\">\r\n" +
" <url>someUrl</url>\r\n" +
" <username>user3</username>\r\n" +
" <password>123456789</password>\r\n" +
" </app>\r\n" +
" </apps>\r\n" +
"</config>";
try {
SOAPMessage message = MessageFactory.newInstance().createMessage(null,new ByteArrayInputStream(xml.getBytes()));
System.out.println(message.getSOAPPart().getElementsByTagName("password").item(0).getTextContent());
message.getSOAPPart().getElementsByTagName("password").item(0).setTextContent("NewPassword");
System.out.println(message.getSOAPPart().getElementsByTagName("password").item(0).getTextContent());
StringWriter messageString = new StringWriter();
TransformerFactory.newInstance().newTransformer().transform(
new DOMSource(message.getSOAPPart()),
new StreamResult(messageString));
BufferedWriter writer = null;
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("file.xml", true), "utf-8"));
writer.write(messageString.toString());
writer.newLine();
writer.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Or you can just use the Marshaller and Unmarshaller, if you want I'll explain how to do it this way.

How can I use the FileProvider to access Download folder?

I made an App that creates a *.csv file inside a folder (made by the same app) and at the same time is inside the Android's Download Folder.
The file can be shared with a ShareIntent, the problem is when the app runs in Android Oreo and the user tries to create the *.csv file, the apps crashes, the thrown exception is:
android.os.FileUriExposedException:
at android.os.StrictMode.onFileUriExposed (StrictMode.java:1958)
at android.net.Uri.checkFileUriExposed (Uri.java:2348)
at android.content.ClipData.prepareToLeaveProcess (ClipData.java:941)
at android.content.Intent.prepareToLeaveProcess (Intent.java:9735)
at android.content.Intent.prepareToLeaveProcess (Intent.java:9741)
at android.content.Intent.prepareToLeaveProcess (Intent.java:9720)
at android.app.Instrumentation.execStartActivity (Instrumentation.java:1795)
at android.app.Activity.startActivityForResult (Activity.java:4495)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult (BaseFragmentActivityJB.java:50)
at android.support.v4.app.FragmentActivity.startActivityForResult (FragmentActivity.java:79)
at android.app.Activity.startActivityForResult (Activity.java:4453)
at android.support.v4.app.FragmentActivity.startActivityForResult (FragmentActivity.java:859)
at android.app.Activity.startActivity (Activity.java:4814)
at android.app.Activity.startActivity (Activity.java:4782)
at com.bpl.spart.bloodpressurelogbook.MainActivity$createReportTask.onPostExecute (MainActivity.java:517)
at com.bpl.spart.bloodpressurelogbook.MainActivity$createReportTask.onPostExecute (MainActivity.java:420)
I know that I should use FileProvider to create Uri's, in API level > 24,but how Can I use the FileProvider to give access from a file inside the Downloads folder?
This is my current code:
Intent ShareIntent = new Intent(android.content.Intent.ACTION_SEND);
ShareIntent.setType("text/csv");
ShareIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {getString(R.string.reporteTomasDePresion)});
ShareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, nombreReporte);
ShareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
startActivity(Intent.createChooser(ShareIntent, getString(R.string.compartirReporte)));
Where "f" is the reference to the .csv file.
public File getDocumentsStorageDir(String directorio){
File file = new File(getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS),directorio);
if(!file.mkdir()){
Log.e("StatusArchivo","Directorio no creado");
}
return file;
}
File file = getDocumentsStorageDir(REPORTDIR);
Calendar cal = Calendar.getInstance();
//sdf = new SimpleDateFormat("dd-MM-yyyy-HH-mm");
nombreReporte = "BPReport"+sdf.format(cal.getTime())+".csv";
f = new File(file.getAbsolutePath(),nombreReporte);
String csvFIle = "";
String sistolicaS;
String diastolicaS;
String pulsoS;
String posicionS;
String extremidadS;
String notaS;
String fechaS;
if(params[0].getCount() > 0 ) {
try {
OutputStreamWriter fout = new OutputStreamWriter(new FileOutputStream(f), StandardCharsets.ISO_8859_1);
String nombre = getString(R.string.Nombre);
String nombreDeUsuario = sharedPref.getString("nombreDelUsuario","");
String edad = getString(R.string.Edad);
String edadUsuario = sharedPref.getString("edadDelUsuario","");
String peso = getString(R.string.Peso);
String pesoUsuario = sharedPref.getString("pesoDelUsuario","");
String UnidadDePeso = sharedPref.getString("unidadPeso",getString(R.string.kilos));
String enfermedades = getString(R.string.Enfermedad);
String enfermedadesUsuario = sharedPref.getString("enfermedadesDelUsuario","");
String linea1 = nombre+": ," + nombreDeUsuario + "\n";
fout.write(linea1);
String linea2 = edad+": ," + edadUsuario + "\n";
fout.write(linea2);
String linea3 = peso+": ," + pesoUsuario + UnidadDePeso + "\n";
fout.write(linea3);
String linea4 = enfermedades+": ," + enfermedadesUsuario + "\n";
fout.write(linea4);
String tituloColumnas = getString(R.string.presionsistolica) + "," + getString(R.string.presiondiastolica) + "," + getString(R.string.pulsotil) + "," + getString(R.string.posiciontil) + "," + getString(R.string.extremidadtil) + "," + getString(R.string.notatil) + "," + getString(R.string.fechatil) + "\n";
fout.write(tituloColumnas);
params[0].moveToFirst();
if (params[0].moveToFirst()) {
for (int j = 0; j < params[0].getCount(); j++) {
sistolicaS = params[0].getString(params[0].getColumnIndex(Contrato.Columnas.SISTOLICA));
diastolicaS = params[0].getString(params[0].getColumnIndex(Contrato.Columnas.DIASTOLICA));
pulsoS = params[0].getString(params[0].getColumnIndex(Contrato.Columnas.PULSO));
posicionS = params[0].getString(params[0].getColumnIndex(Contrato.Columnas.POSICION));
extremidadS = params[0].getString(params[0].getColumnIndex(Contrato.Columnas.EXTREMIDAD));
notaS = params[0].getString(params[0].getColumnIndex(Contrato.Columnas.NOTA));
fechaS = params[0].getString(params[0].getColumnIndex(Contrato.Columnas.FECHA));
Log.v("CSV1", csvFIle);
csvFIle = "\"" + sistolicaS + "\",\"" + diastolicaS + "\",\"" + pulsoS + "\",\"" + posicionS + "\",\"" + extremidadS + "\",\"" + notaS + "\",\"" + fechaS + "\"\n";
Log.v("CSV2", csvFIle);
fout.write(csvFIle);
params[0].moveToNext();
}
}
fout.close();
c.close();
I found the answer by my self, In my paths.xml file I added:
<?xml version="1.0" encoding="utf-8"?>
<paths
xmlns:android="http://schemas.android.com/apk/res/android">
<external-path
name="Descarga"
path="Download/"/>
<files-path name="nombre"
path="reportes" />
</paths>
And in the Java:
I changed:
ShareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
startActivity(Intent.createChooser(ShareIntent,getString(R.string.compartirReporte)));
For:
Uri fileUri = FileProvider.getUriForFile(MainActivity.this,"com.bpl.spart.bloodpressurelogbook.fileprovider",f);
ShareIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
startActivity(Intent.createChooser(ShareIntent, getString(R.string.compartirReporte)));
Also the FileUriExposedException problem in Android Oreo is gone now.

java- resize image on ftp by thumbnailator library

I am uploading image from url on ftp by this code.
Image uploaded successful but when i try to resize uploaded image get error as the follows.
String imageUrl = "http://www.totaldesign.ir/wp-content/uploads/2014/11/hamayesh.jpg";
FTPClient ftpClient = new FTPClient();
ftpClient.connect(ftp_server, ftp_port);
ftpClient.login(ftp_user, ftp_pass);
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
ftpClient.enterLocalPassiveMode();
// APPROACH #2: uploads second file using an OutputStream
URL url = new URL(imageUrl);
//**************select new name for image***********/
//get file extention
File file = new File(imageUrl);
String ext = getFileExtension(file);
//get file name from url
String fileName = imageUrl.substring(imageUrl.lastIndexOf('/') + 1, imageUrl.length());
String fileNameWithoutExtn = fileName.substring(0, fileName.lastIndexOf('.'));
//create new image name for upload
String img_name = "simjin.com_" + fileNameWithoutExtn;
//get current year time for image upload dir
Date date = new Date();
DateFormat yeae = new SimpleDateFormat("yyyy");
String current_year = yeae.format(date);
//create dirs if not exist
ftpClient.changeWorkingDirectory(current_year);
int dirCode = ftpClient.getReplyCode();
if (dirCode == 550) {
//create dir
ftpClient.makeDirectory(current_year);
System.out.println("created folder: " + current_year);
}
//get current month time for image upload dir
DateFormat month = new SimpleDateFormat("MM");
String current_month = month.format(date);
//create dirs if not exist
ftpClient.changeWorkingDirectory("/" + current_year + "/" + current_month);
dirCode = ftpClient.getReplyCode();
if (dirCode == 550) {
//create dir
ftpClient.makeDirectory("/" + current_year + "/" + current_month);
System.out.println("created folder: " + "/" + current_year + "/" + current_month);
}
String uploadDir = "/" + current_year + "/" + current_month;
//rename image file if exist
boolean exists;
String filePath = uploadDir + "/" + img_name + "." + ext;
exists = checkFileExists(filePath);
System.out.println("old file path=> " + exists);
//Rename file if exist
int i = 0;
while (exists) {
i++;
img_name = "simjin.com_" + fileNameWithoutExtn + i;
filePath = uploadDir + "/" + img_name + "." + ext;
exists = checkFileExists(filePath);
//break loop if file dont exist
if (!exists) {
break;
}
}
System.out.println("new file path=> " + filePath);
//set image name in array for return
result[0] = img_name;
//*************end select new name for image**********/
System.out.println("ftpClinet Replay Code=> " + ftpClient.getStatus());
//Start uploading second file
InputStream inputStream = new BufferedInputStream(url.openStream());
OutputStream outputStream = ftpClient.storeFileStream(filePath);
System.out.println("outputStream Status=> " + outputStream);
byte[] bytesIn = new byte[10240];
int read = 0;
while ((read = inputStream.read(bytesIn)) != -1) {
outputStream.write(bytesIn, 0, read);
}
inputStream.close();
outputStream.close();
boolean completed = ftpClient.completePendingCommand();
after success upload. I want to resize image by thumbnailator:
if (completed) {
System.out.println("The file is uploaded successfully.");
String new_img_name = uploadDir + "/" + img_name + "-150x150" + "." + ext;
OutputStream os = ftpClient.storeFileStream(filePath);
Thumbnails.of(image_url).size(150, 150).toOutputStream(os);
}
in this section get this error:
OutputStream cannot be null
Where is my wrong? And how to fix it?

Can't Get Android to Append Data to .txt file

I'm pretty new here, and have been following all I could find on getting my program to append a series of numbers (determined from how often a button was pressed) to a .txt file whenever a timer runs out, but to no avail-I'm not sure what I'm missing...the app starts out by creating a .txt file in the downloads folder with a template in it:
String initialTemplate ="\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\"";
File path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_DOWNLOADS);
File file = new File(path, filename+".txt");
try {
FileOutputStream fos = new FileOutputStream(file);
fos.write(initialTemplate.getBytes());
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
And then when a countdowntimer object finishes and restarts/ends, it triggers the class writeresults() to append the values:
if (CountsRemaining < 1){
textViewTime.setText("00:00:00");
cancel();
writeResults();
finishcount();
} else {
//append data
writeResults();
//Clear all variables
clearCounts();
start();
}
And the important part, to actually write the data, which is what isn't working:
public void writeResults(){
String Message = Count1 + ", " + Count2 + ", " + Count3 + ", " + Count4 + ", " + Count5 + ", " +
Count6 + ", " + Count7 + ", " + Count8 + ", " + Count9 + ", " + Count10 + ", " + Count11 + Count12;
FileWriter writer;
try {
File path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_DOWNLOADS);
File file = new File (path + filename+".txt");
writer = new FileWriter(file, true);
writer.append(Message);
writer.append("this is a writing test message");
writer.close();
Toast.makeText(getApplicationContext(), "Data Saved", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
}
}
Any idea what I might be missing? Parameters?
The problem is in this line:
File file = new File (path + filename+".txt");
It should be like this, if you look at your first code, when creating file:
File file = new File (path, filename+".txt");

Docx4j: PPTX got corrupted while inserting an ellipse object

i have been searching the whole day for a solution but i'm unable to find one. That's why i decided to ask a question.
My problem is that i'm inserting a ellipse object to the PPTX file. When i tries to open the presentation MS OFfice says it's corrupted and tries to repair. It ends up deleting the slide and presents the master slide.
See below my code:
the function officeXReport.getTemplatename() contains the filename of the PPTX (e.g. *Status_Report_template.pptx*)
The template pptx file contains only 1 slide.
The function officeXReport.getNewfilename() contains the new filename of the PPTX (e.g. *Status_Report_2014-03-16.pptx*)
try {
PresentationMLPackage presentationMLPackage = (PresentationMLPackage)OpcPackage.load(new java.io.File(officeXReport.getTemplatename()));
MainPresentationPart pp = presentationMLPackage.getMainPresentationPart();
boolean noLine = false;
STShapeType st = STShapeType.ELLIPSE;
int i = 1;
SlidePart slidePart = (SlidePart)presentationMLPackage.getParts().getParts().get(pp.getSlide(0).getPartName());
Shape sample = ((Shape)XmlUtils.unmarshalString(
getPresetShape(st.value(), noLine, Long.toString(1839580), Long.toString(1314971), Long.toString(184337), Long.toString(184338), "92D050"), Context.jcPML) );
slidePart.getJaxbElement().getCSld().getSpTree().getSpOrGrpSpOrGraphicFrame().add(sample);
presentationMLPackage.save(new java.io.File(officeXReport.getNewfilename()));
} catch (Exception ex) {
System.out.println("Exception thrown = " + ex.getMessage());
return null;
}
The related function getPresetShape():
private static String getPresetShape(String preset, boolean noLine, String x, String y, String cx, String cy, String colorcode) {
String txBody = "";
String ln = "";
String style = "";
if (!noLine) {
ln = "<a:ln w=\"3175\">"
+"<a:solidFill>"
+"<a:srgbClr val=\"000000\"/>"
+"</a:solidFill>"
+"</a:ln>";
style = "<p:style>\n" +
"<a:lnRef idx=\"1\">\n" +
"<a:schemeClr val=\"accent1\"/>\n" +
"</a:lnRef>\n" +
"<a:fillRef idx=\"3\">\n" +
"<a:schemeClr val=\"accent1\"/>\n" +
"</a:fillRef>\n" +
"<a:effectRef idx=\"2\">\n" +
"<a:schemeClr val=\"accent1\"/>\n" +
"</a:effectRef>\n" +
"<a:fontRef idx=\"minor\">\n" +
"<a:schemeClr val=\"lt1\"/>\n" +
"</a:fontRef>\n" +
"</p:style>";
txBody = "<p:txBody>\n" +
"<a:bodyPr rtlCol=\"false\" anchor=\"ctr\"/>\n" +
"<a:lstStyle/>\n" +
"<a:p>\n" +
"<a:pPr algn=\"ctr\"/>\n" +
"<a:endParaRPr lang=\"en-US\" sz=\"1100\" u=\"sng\" dirty=\"false\">\n" +
"<a:latin typeface=\"Futura Com Light\" panose=\"020B0402020204020303\" pitchFamily=\"34\" charset=\"0\"/>\n" +
"</a:endParaRPr>\n" +
"</a:p>\n" +
"</p:txBody>";
}
return
"<p:sp xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:p=\"http://schemas.openxmlformats.org/presentationml/2006/main\">"
+ "<p:nvSpPr>"
+ "<p:cNvPr id=\"32\" name=\"Ellipse 2\" />"
+ "<p:cNvSpPr/>"
+ "<p:nvPr/>"
+ "</p:nvSpPr>"
+ "<p:spPr>"
+ "<a:xfrm>"
+ "<a:off x=\"" + x + "\" y=\"" + y + "\"/>"
+ "<a:ext cx=\"" + cx + "\" cy=\""+ cy + "\"/>"
+ "</a:xfrm>"
+ "<a:prstGeom prst=\"" + preset + "\">"
+ "<a:avLst/>"
+ "</a:prstGeom>"
+ "<a:solidFill>"
+ "<a:srgbClr val=\""+ colorcode + "\"/>"
+ "</a:solidFill>"
+ ln
+ "</p:spPr>"
+ style
+ txBody
+ "</p:sp>";
}
I have looked into the slide1.xml file which is missing the XML header compared to a correct slide1.xml file :
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
How can i get the xml header definition into the slide1.xml ?
Thanks,
Asad

Categories