java代码采取屏幕打印的单词

时间:2017-05-22 18:18:15

标签: java

我想用单词进行丝网印刷,我正在使用下面的代码。使用下面的代码,我可以用单词进行丝网印刷,但只有两个丝网印刷用于保存在我的单词doc中,它也取代了旧的和新的丝网印刷用于粘贴在那里。你能不能帮我纠正我迟滞的代码。

    FileUtils.copyFile(scrFile, new File(strimage));

   CustomXWPFDocument document = new CustomXWPFDocument();

    // Adding a file
    try {

        // Working addPicture Code below...
        XWPFParagraph paragraphX = document.createParagraph();

        paragraphX.setAlignment(ParagraphAlignment.CENTER);

        String blipId = paragraphX.getDocument().addPictureData(new FileInputStream(scrFile),Document.PICTURE_TYPE_JPEG);

        document.createPicture(blipId,
                document.getNextPicNameNumber(Document.PICTURE_TYPE_JPEG),600, 300);
       System.out.println("5");

    } catch (InvalidFormatException e1) {
        // TODO Auto-generated catch block " + String.valueOf(x) + "
        e1.printStackTrace();
    }
    FileOutputStream outStream = null;
    try {
        double x = Math.random();
        System.out.println("5");
        File file = new File("C:\\Selenium_Framework_Rajesh\\Scripts\\Eximbills\\SnapShots\\Mydoc.docx");
   //Santosh
        outStream = new FileOutputStream(file);
       if(!file.exists()){
            file.createNewFile();

        String fileName = "C:\\Selenium_Framework_Rajesh\\Scripts\\Eximbills\\SnapShots\\Mydoc.docx";

        System.out.println("5");


                }
    } catch (FileNotFoundException e) {
        System.out.println("First Catch");
        e.printStackTrace();
    }


    try {

        // Working addPicture Code below...
        XWPFParagraph paragraphX = document.createParagraph();

        paragraphX.setAlignment(ParagraphAlignment.CENTER);

        String blipId = paragraphX.getDocument().addPictureData(new FileInputStream(scrFile),Document.PICTURE_TYPE_JPEG);

        document.createPicture(blipId,
                document.getNextPicNameNumber(Document.PICTURE_TYPE_JPEG),600, 300);
       System.out.println("5");

    } catch (InvalidFormatException e1) {
        // TODO Auto-generated catch block " + String.valueOf(x) + "
        e1.printStackTrace();
    }
   document.write(outStream);
   outStream.flush();
   outStream.close();



} 

0 个答案:

没有答案