From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Ensure that a comment text is only one line

Hello,

Is there a way to programatically ensure that a comment text is only one line? I can populate a comment with a text from a channel property with Report.ActiveSheet.Objects.Item("CommentBox").Comment.Text = Data.Root.ChannelGroups("Channel").Properties("Desired_URL").Value. I am populating the comment box with a URL. This needs to be only one line since when it is exported to a PDF, it can only be clicked if it is one line. I was thinking of finding the number of characters in the url and then doing an if...elseif...else statement to conditionally change the font size of the comment. I'm not sure if this is possible with DIAdem, I'm having trouble finding the length of a text.

I was first trying to programatically change the contents of a free text since that will automatically change the font size, but this is not possible, so is there a way to have the font size automatically change to fit the comment box with hard coded dimensions?

0 Kudos
Message 1 of 2
(2,178 Views)

You can find the length of a string by using the Len() function in VBScript.  Does that help to implement your current strategy?

 

e.g.

 

dim StoredString
StoredString = "this sentence is 36 characters long."
MsgBox(Len(StoredString))

 

Should display a message box with the text "36".

Highest Regards,

Paul
0 Kudos
Message 2 of 2
(2,140 Views)