how to set watermark image at background in excel

2020-07-27 02:08发布

问题:

i am using the following code to set water mark in the excel sheet, i also get the water mark but instead of showing the watermark at the back round it shows the water mark at foreground.

how to resolve this, the code :

//to add water mark
                HSSFPatriarch dp = sheet.createDrawingPatriarch();
                HSSFClientAnchor anchor = new HSSFClientAnchor
                    (0, 0, 1023, 255, (short) 2, 4, (short) 13, 26);
                HSSFTextbox txtbox = dp.createTextbox(anchor);
                HSSFRichTextString rtxt = new HSSFRichTextString("POC");
                HSSFFont draftFont = hwb.createFont();
                draftFont.setColor((short) 27);
                draftFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
                draftFont.setFontHeightInPoints((short) 192);
                draftFont.setFontName("Verdana");
                rtxt.applyFont(draftFont);
                txtbox.setString(rtxt);
                txtbox.setLineStyle(HSSFShape.LINESTYLE_NONE);
                txtbox.setNoFill(true);

also how to merge the cells to add title at the top of the excel sheet using poi in java?

Please help me to find and resolve the isssue.