Wed Aug 19, 2020 10:21 am
Hello Rachel,
Thanks for a quick response.
This code works well when i execute with a predefined PPT template with an smart art already placed. However, when i try to add smartart at run time and then first i removed all the nodes from SmartArt in blank template and then i am adding nodes one by one and filling them based on my requirements.so, if i try to add one node in its and then try to format the border line of node then it throw NullReferenceException Erorr. I am attaching a screen shot and sample code for that. Could you please help me on this.
Moreover, it seems that the code to format connector line from a node to another node is also not working properly. Could you please check this one also.
Please see the code below which i am using.
Dim ppt As Presentation = New Presentation()
Dim smartArt As ISmartArt
Dim node_parent As ISmartArtNode
Dim midNode As ISmartArtNode
Dim gcNode As ISmartArtNode
ppt.LoadFromFile("C:\Users\A0741818\Documents\Visual Studio 2015\WebSites\Hyperlink Error on node in SmartArt in PPT\Presentation_node and connecter formatting.pptx")
smartArt = ppt.Slides(0).Shapes.AppendSmartArt(50, 50, 1000, 1000, SmartArtLayoutType.OrganizationChart)
For Each node As ISmartArtNode In smartArt.Nodes
smartArt.Nodes.RemoveNode(node)
Next
node_parent = smartArt.Nodes.AddNode()
node_parent.Line.FillType = Drawing.FillFormatType.Solid
node_parent.Line.SolidFillColor.Color = System.Drawing.Color.LightGray
node_parent.Line.Width = 5
node_parent.Line.DashStyle = LineDashStyleType.SystemDash
node_parent.LinkLine.FillType = Drawing.FillFormatType.Solid
node_parent.LinkLine.SolidFillColor.Color = System.Drawing.Color.DarkGreen
node_parent.LinkLine.Width = 8
node_parent.LinkLine.DashStyle = LineDashStyleType.SystemDash
midNode = node_parent.ChildNodes.AddNode()
gcNode = midNode.ChildNodes.AddNode()
gcNode.Line.FillType = Drawing.FillFormatType.Solid
gcNode.Line.SolidFillColor.Color = System.Drawing.Color.LightBlue
gcNode.Line.Width = 7
gcNode.Line.DashStyle = LineDashStyleType.SystemDash
gcNode.LinkLine.FillType = Drawing.FillFormatType.Solid
gcNode.LinkLine.SolidFillColor.Color = System.Drawing.Color.DarkOrange
gcNode.LinkLine.Width = 4
gcNode.LinkLine.DashStyle = LineDashStyleType.SystemDashDot
ppt.SaveToFile("C:\Users\A0741818\Documents\Visual Studio 2015\WebSites\Hyperlink Error on node in SmartArt in PPT\result new.pptx", FileFormat.Pptx2013)
Thanks in Advance. Looking for a positive response.
Thanks & Regards,
Anil Kumar
Login to view the files attached to this post.