Closed taumoeps closed 3 years ago
What does the exception say? There should be more details in the inner exceptions.
Below is the full error. It stops when hitting this line: shpNew.Cells("FillForegnd").FormulaU = "RGB(242, 242, 242)";
The weird thing is I can manually change the fill color in the shape style tab by clicking on the fill button It then updates the FillForegnd field to: =THEMEGUARD(MSOTINT(THEMEVAL("AccentColor"),-25))
Ive also tried using the THEMEGUARD value in the FormulaU cell and still get the same error
{"Message":"An error has occurred.","ExceptionMessage":"Failed to proceed PropertySet on Visio.IVCell=>FormulaU.","ExceptionType":"NetOffice.Exceptions.PropertySetCOMException","StackTrace":" at NetOffice.Invoker.PropertySet(ICOMObject comObject, String name, Object[] value)\r\n at NetOffice.CorePropertySetExtensions.ExecuteValuePropertySet[T](Core value, ICOMObject caller, String name, T newValue)\r\n at NetOffice.VisioApi.IVCell.set_FormulaU(String value)\r\n at T.A.D_DWO.Controllers.DWOController.DrawModel(List1 tadModelList, Int32 totalColumns, Application application, IVDocument document, IVPage visioPage, IVDocument visioStencil) in C:\\Users\\Steve\\Source\\Repos\\T.A.D-DWO\\T.A.D-DWO\\Controllers\\DWOController.cs:line 266\r\n at T.A.D_DWO.Controllers.DWOController.DrawDiagram2(TADLayerObj tadLayerObj, String fileName) in C:\\Users\\Steve\\Source\\Repos\\T.A.D-DWO\\T.A.D-DWO\\Controllers\\DWOController.cs:line 129\r\n at T.A.D_DWO.Controllers.DWOController.<DiagramApi3>d__1.MoveNext() in C:\\Users\\Steve\\Source\\Repos\\T.A.D-DWO\\T.A.D-DWO\\Controllers\\DWOController.cs:line 40\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__1
1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.
The inner exception is Cell is guarded.
https://visualsignals.typepad.co.uk/vislog/2018/11/formulau-and-formulaforceu-in-visio.html
You must use FormulaForceU
to change the expression.
Trying to set the fill and line color for a Visio Container shape, but error below.
Failed to proceed PropertySet on Visio.IVCell=>FormulaU.
However it will let me change the shape text and size. Any ideas? Ive tried remove the theme, used the default SDCONT_M.VSSX stencil as well as create my own stencil. Code below