Skip to content

Add Support for twoCellAnchor Object Positioning for Drawing #1159

Closed
@sgarwood

Description

This is:

- [ ] a bug report
- [x] a feature request
- [x] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behaviour?

When creating an image in Excel there is the option to use 2 cell anchoring or 1 cell anchoring.

This allows users in Excel to scale the image with the cell in a more robust manner and makes
editing the spreadsheet manually after export less cumbersome.

OpenXML specificaion
http://officeopenxml.com/drwPicInSpread-twoCell.php

Example of desired behaviour

$drawing->setName('Paid');
$drawing->setDescription('Paid');
$drawing->setPath('./images/paid.png');

// New features below

$drawing->setTopRightCell('B15'); // alias to $drawing->setCoordinates('B15');
$drawing->setBottomRightCell('D20');

$drawing->editAs('oneCell'); // possible values are, oneCell, twoCell or absolute
$drawing->setOffsetX(110);

Exact semantic's of API can be discussed in #1160

What is the current behaviour?

Currently, there is only support for One Cell positioning

What are the steps to reproduce?

Please see above

Which versions of PhpSpreadsheet and PHP are affected?

All current releases

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions