Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Get per line of text in shapenmode.text (Read 3125 times)
Ivan Gamo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 30
Joined: Nov 10th, 2012
Get per line of text in shapenmode.text
Jan 16th, 2013 at 5:13am
Print Post  
how to get per line of text in diagramview shapenode.text?
the Environment.NewLine doesnt's work!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get per line of text in shapenmode.text
Reply #1 - Jan 16th, 2013 at 8:19am
Print Post  
It works in my test:

Code
Select All
var n = diagram.Factory.CreateShapeNode(50, 50, 100, 50);
n.Text = "line1" + Environment.NewLine + "line2";
//n.EnableStyledText = true; 



Have you set any flags in node.TextFormat?
  
Back to top
 
IP Logged
 
Ivan Gamo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 30
Joined: Nov 10th, 2012
Re: Get per line of text in shapenmode.text
Reply #2 - Jan 16th, 2013 at 11:31am
Print Post  
sorry for incomplete explanation but i want to get or split  every new line of text inside the node and store it in array like for example the node name is shapeini and the array name is txtPerLine

txtPerLine = shapeini.text.Split(Environment.NewLine)

thanks.
  
Back to top
 
IP Logged
 
Ivan Gamo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 30
Joined: Nov 10th, 2012
Re: Get per line of text in shapenmode.text
Reply #3 - Jan 16th, 2013 at 11:32am
Print Post  
no i haven't set any flags in node.TextFormat
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get per line of text in shapenmode.text
Reply #4 - Jan 16th, 2013 at 1:27pm
Print Post  
The Split method expects an array of delimiter strings:

var lines = node.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

This will let you find new lines entered by the user when editing, but not the line wrap positions used when long text is wrapped at node borders.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Ivan Gamo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 30
Joined: Nov 10th, 2012
Re: Get per line of text in shapenmode.text
Reply #5 - Jan 17th, 2013 at 6:18pm
Print Post  
Thanks Stoyan. Grin
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint