how to set watermark image at background in excel

2020-07-27 01:57发布

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.

0条回答
登录 后发表回答