Hi,

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
http://poi.apache.org/guidelines.html#FileFormatInformation

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 =
sheet.getCTWorksheet().getHeaderFooter();
    assertEquals("&C&G", headerFooter.getOddHeader());

    for(POIXMLDocumentPart part : sheet.getRelations()) {
        assertNotNull(part);
        
if(part.getPackagePart().getPartName().getName().contains("drawings/vmlDrawing"))
{
            System.out.println("Found vmlDrawing-part: " + part);
            for (POIXMLDocumentPart relation : part.getRelations()) {
                System.out.println("Found relation: " + relation);
            }
        }
    }


Dominik.



On Tue, Oct 18, 2016 at 1:11 PM, Daniel Küppers <dan...@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-unsubscr...@poi.apache.org
> For additional commands, e-mail: user-h...@poi.apache.org
>
>

Reply via email to