vb.net - How to keep VSTO Powerpoint-COM-Add-In in sync with Powerpoint application on user shape delete action -
i'm working on vb.net based vsto powerpoint-com-add-in.
i shape automation stuff , running errors when user deletes shapes reside within grouped shape.
example: create 3 rectangles - group them - delete 1 rectangle without ungrouping
when check number of groupitems
in group doesn't refreshed (it should decreased number of deleted shapes, e.g. one), have still 1 or more references no longer existing shapes in application causes exceptions being thrown.
i can recognize problem looking special conditions , catching error, have ugly workaround "sync" add-in powerpoint application in case performing "ungroup.group"-command comes further downsides.
if blastselectionwasgroupchildonly andalso globals.thisaddin.application.activepresentation.hasoneshapeselected andalso globals.thisaddin.application.activepresentation.firstselectedshape.type = microsoft.office.core.msoshapetype.msogroup '*** vorhergehende selektion durchgehen / check last selection while olastselection.count > 0 try dim sndummy single = olastselection.first.left : olastselection.remove(olastselection.first) catch ex exception system.diagnostics.trace.writeline("deleted shape found!") '*** workaround until forced sync of add-in , powerpoint known globals.thisaddin.application.activepresentation.firstselectedshape.ungroup.group() : exit end try loop end if
olastselection
list(of powerpoint.shape)
how can correctly sync add-in powerpoint. looked through system.runtime.interopservices
couldn't done, lack of understanding it.
to clarify: happens if shape deleted group still keeps group after deletion because there 2 or more shapes remaining in group. if there 1 shape left in group ungrouped automatically , fine. me looks bug still i'm using wrong strategy.
Comments
Post a Comment