vsto - Getting error when adding programmatically a custom smartart shape in PowerPoint -
i created 3 smartart shapes, , put them folder: "c:\users...\appdata\roaming\microsoft\templates\smartart graphics", , powerpoint load them successfully. can call them ui, if @ beginning once powerpoint opened, , add smartart shape slide programmatically, following error:
"the index specified collection out of bounds"
however if add smartart shape ui first, there no error if want add smartart shape code after that.
my smartart shapes: smartart resources
my code is:
microsoft.office.core.smartartlayout mylayout = null; try { mylayout = powerpointapp.smartartlayouts["smartartabs3"]; } catch (exception ex) { messagebox.show(ex.message); questionlayout = null; } if (questionlayout != null) { powerpoint.shape smshape = allshapes.addsmartart(mylayout, left, top, width, height); //..... }
note: using vs ultimate 2013, powerpoint 2013, c#, add-in-express
pretty sure cannot use name index must use index (long)
if don't know loop through names till find match find it.
Comments
Post a Comment