poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominik Stadler <dominik.stad...@gmx.at>
Subject Re: XSSF header image
Date Wed, 19 Oct 2016 07:09:20 GMT

There are some similar questions on Stackoverflow, but unfortunately no
useful answer yet. A quick look at an unzipped .xlsx file (they are
actually .zip files) shows that Excel saves it via some
vmlDrawing->rel->media/image1.jpg structure, but Apache POI does not fully
support setting this structure, so you will need to research the spec from
Microsoft some more and try to add these things manually. See e.g. 6.4 VML
- SpreadsheetML Drawing in Office Open XML Part 4 - Markup Language
Reference.pdf in the specs, see

Here some code which inspects an existing Excel file with a header image,
the marker seems to be "&C&G" here.

    final XSSFSheet sheet = wb.getSheetAt(0);

    final CTHeaderFooter headerFooter =
    assertEquals("&C&G", headerFooter.getOddHeader());

    for(POIXMLDocumentPart part : sheet.getRelations()) {
            System.out.println("Found vmlDrawing-part: " + part);
            for (POIXMLDocumentPart relation : part.getRelations()) {
                System.out.println("Found relation: " + relation);


On Tue, Oct 18, 2016 at 1:11 PM, Daniel K├╝ppers <daniel@tetralog.com> wrote:

> Hello everyone,
> i want to place an image in the background header and footer in a
> XSSFSheet.
> I read the documentation which states that the parameter *&G* is to be
> used, but not actually how.
> The apache poi bug tracker also refers to this user list to ask a question
> about this.
> I searched through the list archives but couldnt find any reference
> talking about this.
> Do you have any advice for me? I really appreciate any hints.
> Regards,
> Daniel
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message