I want to be able to programmatically add text like H2O where the 2 is subscript. I'm trying to do this with
t.Cells[r, c].AddNLWTag('H'+#$2082+'O', NORMAL, RIGHT, '');
Except I simply see a box where the subscript "2" should be. What am I doing wrong?
programmatically adding subscripted string
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: programmatically adding subscripted string
The second parameter of AddNLWTag is the index of RVStyle.TextStyles collection.
Pass the index of item having SubSuperScriptType = rvsssSubScript
See also:
http://www.trichview.com/forums/viewtop ... 37&p=32795
This topic contains examples how to create text styles with required properties, including sub/superscript.
Pass the index of item having SubSuperScriptType = rvsssSubScript
See also:
http://www.trichview.com/forums/viewtop ... 37&p=32795
This topic contains examples how to create text styles with required properties, including sub/superscript.
Re: programmatically adding subscripted string
Thanks Sergey, that helps. However, I need to be able to add three bits of text into a table cell. The actual string is something like this
'Pressure, in-H2O (a)'
Therefore, I need to add three successive strings:
leftStr := 'Pressure, in-H';
subScriptStr := '2';
rightStr := 'O (a)';
I am able to get add strings in the table cell, but each adds to its own line. I need them on the same line.
Mike
'Pressure, in-H2O (a)'
Therefore, I need to add three successive strings:
leftStr := 'Pressure, in-H';
subScriptStr := '2';
rightStr := 'O (a)';
I am able to get add strings in the table cell, but each adds to its own line. I need them on the same line.
Mike
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: programmatically adding subscripted string
The second and the third string in the line must be added with -1 in ParaNo parameter of AddNLWtag.
PS: before adding content to a cell, clear it: Cell.Clear.
PS: before adding content to a cell, clear it: Cell.Clear.
Re: programmatically adding subscripted string
perfect - thanks Sergey!