Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParentGroup of ExcelDrawing #1435

Open
FedePorti opened this issue Apr 29, 2024 · 3 comments
Open

ParentGroup of ExcelDrawing #1435

FedePorti opened this issue Apr 29, 2024 · 3 comments

Comments

@FedePorti
Copy link

FedePorti commented Apr 29, 2024

Hi, I have several problems with an excel that has some grouped drawings.

image

I want to access to the drawing inside the group (for example: D2_a_BT, D2_b_BT, etc)

image

I think to access this drawing I would have to do like this (to edit the text of the shape):

sheet1.Drawings.Item("Img_D2_BT").ParentGroup.Drawings.Item("D2_a_BT").As.Shape.Text = "A1"

The problem is that ParentGroup is null.

I also try to UnGroup the shape to edit the child and after Group again, but also I can UnGropup the shape.

image

It seems that epplus takes it as not being grouped.

Also in the imagen you can see that the property Size is null too.

I attached my Excel
CalcTF_Amb4.xlsx

@JanKallman
Copy link
Contributor

JanKallman commented Apr 30, 2024

It seems like there is a bug when trying to access child drawing via the name. I will add a fix for that.
For now, use a linq query or similar...

                var groupDrawing = ((ExcelGroupShape)sheet.Drawings["img_d2_bt"]);
                var childLine1 = groupDrawing.Drawings.FirstOrDefault(x=> x.Name=="D2_Line1_BT");
                 //Instead of...
                 var childLine2 = groupDrawing.Drawings["D2_Line2_BT"];
                 //...Or use the index:
                  var childc = groupDrawing.Drawings[3];

The Size property will be null on drawings that have the EditAs property set to OfficeOpenXml.Drawing.eEditAs.TwoCell
Depending on the EditAs property value, you use the properties From, To, Position or Size to get/set the drawings position.
The ParentGroup will be set to null for all top-level drawing (in the worksheet.Drawings Collection). Group Drawings (like "D2_Line1_BT"), have the ParentGroup property set to the group drawing that contains it (in this case "img_d2_bt").

@FedePorti
Copy link
Author

Thank you, I use linq and it works. And also works the Size, I already have the property EditAs set to OneCell but after I call the Size (so I move before and it works).

@JanKallman
Copy link
Contributor

Great, I have added a fix for the Name Indexer issue.

OssianEPPlus added a commit that referenced this issue May 3, 2024
Fixes issue #1435 - Name indexer on group drawings did not work.
JanKallman added a commit that referenced this issue May 13, 2024
* LoadFromCollection/new logic for member sort order (#1296)

* wip

* wip2

* wip

* Wip 2

* wip

* First version of LoadFromCollection after refactoring

* wip 3

* WIP 3

* Adjusted CreatePropertyGetter so it supports inheriting classes to

* Removed uncommented code

---------

Co-authored-by: swmal <{ID}+username}@users.noreply.github.com>

* Feature/cf html exporter (#1349)

* New css and html connection based on CF. Poor performance

* Added Quadtree fetched CF-dictionary

* First solution functional on single cells

* Added support for more types and start of class diagraAdded support for
more types and start of class diagramm

* Temp draft save

* Added endsWith

* Added several styles to dxfCss

* Fixed underline and strike through but can't stop strikethrough double

* Staticified some caches

* Added wrapper

* Broke out stylecache from css adjusted names of css styles to stack in
right specificity order and fixed bug in get collection from range

* Completely removed stylecache from writers

* Initial creation of new writers

* Ensured translator and new writer can handle fills

* Added TranslatorBase fill font and translatorContext logic

* Added border and textFormat translators

* Simplified rangeTranslator and added sharedClasses

* Added stylecache

* Added picture translator

* Properties and new if-case

* Added stylechecker class

* Translators

* Start of adding dxf

* Generic style draft

* First draft of styleContracts

* New draft applying interfaces instead

* Adding of color

* color fixes

* Color added

* Added initial border

* Renamed interface style and re-introduced merged cells

* Attempt at delegates

* New handling of intersect detection

* Simplification of conditionalFormatting

* Started adding tables. Alignment missing on range

* Added start of table writer replacement

* Added table support

* Fixed bugs for table in range. In process of fixing tableExporter

* minor fix

* Added async writing to new methods

* Async support and table/range unification

* Finialized unification

* Fixes fill when no fill was present

* Fixed multiple bugs to ensure all tests pass

* Cleanup and deletion of old files

* Html alternative draftHtml

* Half-implemented header row

* Added htmlElement to headerRow

* Function breakout and start of renderTablerows

* Fixed minor formatting htmlsync bugs

* Simplified writer fixed html formatting of images in cells

* Start of joint functions for html tables and ranges

* Moved range over to standard functions. Removed unused functions

* Performance fixes using hashes

* Minor improvements

* Generalized sync async html and removed unused functions

* Cleaned up and unified functionality

* Fixed CF and hyperlink bugs. Removed classDiagram

* Fixed hyperlinks and unnecesary whitespaces after

* Fixed not adding whitespaces where appropriate

* Added containsErrors cf

* Added cf_Between shouldApply with edge cases and missmatches

* Added fix for calculatedFormula issues

* Fixed cell value set bug and simplified between

* Added simplifications, bug fix and test

* Added Averages to exporter/shouldApply

* Added should apply for timeGroup between greater than and less than

* Added standardDeviation should apply

* Added unique shouldApply

* Added TopBottom function

* Added basic twoColorScale implementation

* Ensured range functionality on headers and easier implementation of
future special cases

* Added faulty 3 color

* Ensured Threerange is correct when values non-linear

* Started adding databar

* Half-made databar

* Added better chaching of cellValues

* removed empty line

* Ensured removal of tempExport Data. Positive databar implementation

* further partial databar implementation

* Fixed text-alignment and color scale dissapear issues

* Adding Databar functionality

* Added databar border and moved to css

* Added axis position start

* Added variable axis position in html exporter for databars

* Added horizontal and vertical text-alignment to databars

* Added databar solution to header

* Start of shared formulas for cfs

* Added dynamically calculated formulas to cfs

* Resolved Token list not clearing on between bug

* Simplification of css data gathering and cleanup

* Added highly innefficent colName solution

* Fixed notbetween handling

* Added null-handling for cellIs shouldApply functions

* Fixes for text functions

* Fixes for end users

* Fixes issue #1292

* Bug/s608 first sheet deletion (#1294)

* Beggining of solution

* Simplified solution. Added tests and exception

* Cleanup

* Fixes issue #1298

* Added test

* Fixed test

* Fixes issue #1298 (#1299)

* Fixes issue #1298

* Added test

* Fixed test

* EPPlus version 7.0.9

* Fixes issue #1302

* Fixes issue 1304

* Resolved null-reference bugs and spell-checked "extentions"

* Ensured top/bottom can handle error and other values correctly

* Removed stale exception

* Fixes issue #1308

* Fixes #1313. Better handling of defined names and encode ExcelNamedRange.NameValue property on save

* Ensured shouldApply as appropriate

* Added new test class

* Bugfixing

* Bug/s615 data validation read (#1307)

* Added new test removed issue test

* Added readwrite to test for confirmation

* Added fixed issues

* Secured DataValidation reading. Fixed i1312

* Non-working strict solution

* Resolved dataValidation read issues. Added docs

* Cleanup and commenting

* Make test happy in production

---------

Co-authored-by: Jan Källman <jan.kallman@epplussoftware.com>

* Fixes issue #1320 (#1322)

* Bug/issue1321 (#1324)

* Fixes issue #1320

* Fixes issue #1321

* Added CellStore Test

* #1329 - adjusted ActiveTab when moving worksheets

* #1327 - EPPlus removed all styling when setting a Table's CalculatedFormula to an empty string

* #1327 - fixed failing unit test, added ClearFormulas call

* #1332 - Intersect operator was replaced with 'isc' when copying cells (#1333)

* #1332 - Intersect operator was replaced with 'isc' when copying cells

* #1332 - removed the added static DefaultPreserveWhiteSpace from SourceCodeTokenizer

* Fixes issue #1338

* Updated fixed issues

* Fixed text contains error

* Fixes issue #1341

* Bug/issue1338 (#1340)

* Fixes issue #1338

* Updated fixed issues

* Colorscale bugfix

* Added fix for two colorscale as well

* EPPlus version 7.0.10

* Fixes #1343. Writing and loading pivot table attribute on CFs (#1344)

* Fixes #1343. Writing and loading pivot table attribute on CFs

* Added docs

* Bug/s635 insert row (#1346)

* Fixes #1345 fixed read exception faulty while loop

* Added template-free test

* fixed LastToken and added docs

---------

Co-authored-by: Jan Källman <jan.kallman@epplussoftware.com>

* Fixed databars, table alignment, flagging conditionalFormatting as
optional

* Cleanup comments usings and top of file

* Removal of databars + cleanup

---------

Co-authored-by: JanKallman <jan.kallman@epplussoftware.com>
Co-authored-by: swmal <897655+swmal@users.noreply.github.com>

* pseudocode for fixed width

* Pseudocode for reading fixed width

* Emergency fill fix (#1357)

* Fixed Width text reading.

* Feature/rich text (#1352)

* Fixes issue #1292

* Bug/s608 first sheet deletion (#1294)

* Beggining of solution

* Simplified solution. Added tests and exception

* Cleanup

* Fixes issue #1298

* Added test

* Fixed test

* Fixes issue #1298 (#1299)

* Fixes issue #1298

* Added test

* Fixed test

* EPPlus version 7.0.9

* Fixes issue #1302

* Fixes issue 1304

* Fixes issue #1308

* Fixes #1313. Better handling of defined names and encode ExcelNamedRange.NameValue property on save

* Added new test class

* Bug/s615 data validation read (#1307)

* Added new test removed issue test

* Added readwrite to test for confirmation

* Added fixed issues

* Secured DataValidation reading. Fixed i1312

* Non-working strict solution

* Resolved dataValidation read issues. Added docs

* Cleanup and commenting

* Make test happy in production

---------

Co-authored-by: Jan Källman <jan.kallman@epplussoftware.com>

* Fixes issue #1320 (#1322)

* Bug/issue1321 (#1324)

* Fixes issue #1320

* Fixes issue #1321

* Added CellStore Test

* #1329 - adjusted ActiveTab when moving worksheets

* #1327 - EPPlus removed all styling when setting a Table's CalculatedFormula to an empty string

* Progress on RichText optmimzation.

* Added more tests

* Fixed color auto property not being read properly

* #1327 - fixed failing unit test, added ClearFormulas call

* Deleted old files and fixing tests.

* #1332 - Intersect operator was replaced with 'isc' when copying cells (#1333)

* #1332 - Intersect operator was replaced with 'isc' when copying cells

* #1332 - removed the added static DefaultPreserveWhiteSpace from SourceCodeTokenizer

* Fixed some more tests not passing.

* Updated a test.

* Fixes issue #1338

* Updated fixed issues

* Fixes issue #1341

* Bug/issue1338 (#1340)

* Fixes issue #1338

* Updated fixed issues

* EPPlus version 7.0.10

* Fixed rich text for more tests.

* Fixes issue #1335

* Fixes #1343. Writing and loading pivot table attribute on CFs (#1344)

* Fixes #1343. Writing and loading pivot table attribute on CFs

* Added docs

* Bug/s635 insert row (#1346)

* Fixes #1345 fixed read exception faulty while loop

* Added template-free test

* fixed LastToken and added docs

---------

Co-authored-by: Jan Källman <jan.kallman@epplussoftware.com>

* Fixed richtext issues.

* Fixed issue when having multiple spaces is a intersect operator and use keep whitespaces

* Fixed issue with rich text comments not being saved & rich text attrobutes not being copied.

* Cleaned up richtexttests

* Added copy worksheet test for richtext

* Removed RichTextAttributes and using properties again.

* Moved files and deleted new folder.

* Fixed GetIndexColor - as it has been moved to Styles

* Fixed some issues with failed tests

* Ensured mergedcells border can be null

* Fixed remove in ExcelParagraphCollection.

* Removed commented code.

---------

Co-authored-by: JanKallman <jan.kallman@epplussoftware.com>
Co-authored-by: OssianEPPlus <122265629+OssianEPPlus@users.noreply.github.com>
Co-authored-by: swmal <897655+swmal@users.noreply.github.com>
Co-authored-by: Ossian Edström <ossian.edstrom@epplussoftware.com>

* Fixed a few bugs in the new html export

* Progress on Reading fixed width column text files.

* Fixed return range

* Changed output path in TableExporterTests

* Changed so user now need to set the column lengths in exceltextformat instead of passing it to the read method.

* Started working on support for reading fixed width text files from position.

* Read fixed width files with post start positions
Read specified columns

* Read fixed width from fileinfo and specify conditions for readin rows with Func

* Started work on saving fixed width text.

* Added test and exportconditionalformatting.xlsx in the workbooks folder

* Save fixed width files

* Save fixed width file progress

* Refactoring reading and saving fixed width text files. Now has a properties for each column.

* Fixed duplicates ignore case

* Made priority work by inversing Order

* Fixed Width test reading and saving.

* Fixed sometimes empty _baseFormula

* Cleanup and bugfix. Fixed cf style read, added comments, ensured
priority reads correctly

* Fixed breaking change

* #1301 - initial implementation of NumberFormatProvider in LoadFromCollection (#1381)

Co-authored-by: swmal <{ID}+username}@users.noreply.github.com>

* Fixed failing test s312

* Support for excluding rows and columns when saving CSV

* Added xml comments. Fixed issues with failing tests.

* Added name property to fixed width reading.

* Test for example

* changed named of variables for clarity & updated xml comments.

* Load from text to transpose, csv & fixed width

* Fixed Text width transpose test

* Fixes issue #1421 (#1422)

* Fix exception message in automapping in ToCollection (#1423)

* Fix #1416 nullable members in LoadFromCollection() (#1417)

* Fix #1416 nullable members in FromCollection

* Replaced issue test with more appropriate thourough test

* Added comments and ensuring headers

* EPPlus version 7.1.2

* Updated release date in version history

* Fixed isses wth fixed wiidth

* Changed how reading and saving using positions in fixed width files.

* fixed small reading fixed width issue

* added validation on position values.

* DataValidation lists can now read showDropDown=0 (#1430)

* DataValidation lists can now read showDropDown=0

* Added fixed issues

* Fixed issues regarding usability

* Fixed cultureInfo issue in test

* Added xml documentations

* Fixes issue #1435 - Name indexer on group drawings did not work.

* Ensured correct read write of custom iconset and gte (#1433)

* build: Use central package management (#1424)

* build: Use central package management

* build: Fix `DefineConstants` value for test project

---------

Co-authored-by: Jan Källman <jan.kallman@epplussoftware.com>

* Fixed issues with csv exporting

* Bug/i1423 (#1437)

* Ensured clearing

* Failing test for remove. Cannot remove individual cells

* Functional non-optimized rangeDictionary fix

* Added ClearRows method. Resolved Edge case

* Simplified

* Compressed and simplified further

* Cleanup

* Added fixed issues

* cleaned up comment

* Fixed some faing tests and removed some other tests

* FIxed some tests. Refactoring names

* ColumnLengths fix

* fixed width can now take -1 as last parameter to read until eol.

* Minor refactoring and added new tests

* Fixed some issues with fixed width reading, added async saving.

---------

Co-authored-by: Mats Alm <897655+swmal@users.noreply.github.com>
Co-authored-by: swmal <{ID}+username}@users.noreply.github.com>
Co-authored-by: OssianEPPlus <122265629+OssianEPPlus@users.noreply.github.com>
Co-authored-by: JanKallman <jan.kallman@epplussoftware.com>
Co-authored-by: Ossian Edström <ossian.edstrom@epplussoftware.com>
Co-authored-by: Antonis Kordatzakis <akorda@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants