CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2009
    Posts
    1,355

    [VB2010] - RTF format: how change row height?:(

    i have these nice sub for insert a table:
    Code:
    Public Sub InsertTable(ByVal Rows As Integer, ByVal Columns As Integer, Optional ByVal ColWidth As Integer = 700, Optional ByVal RowHeight As Integer = 2000)        Dim _Rtf As String
            _Rtf = "\par"
            ' I Fixed the column size here you can change it on your own
            For row As Integer = 1 To Rows
                _Rtf &= "\trowd\trautofit1\trgaph108\trrh" & (RowHeight * row).ToString & "\trleft36" 'these last comand is the left row position
                'The following  For loop is just an example you make a list of columnWidth and  and you can assign it here
                For col As Integer = 1 To Columns
                    _Rtf &= "\clbrdrt\brdrdb\brdrsh\brdrs\clbrdrr\brdrdb\cellx" & (ColWidth * col).ToString
                Next
                _Rtf &= "\pard"
                _Rtf &= "\intbl\row"
            Next
            _Rtf &= "\pard"
            Dim tmpstr As String = Me.Rtf
            Me.Rtf = tmpstr.Insert(tmpstr.LastIndexOf("\par" & tmpstr.Chars(tmpstr.Length - 2)), _Rtf)
        End Sub
    i have read that the "\trrhN" RTF command is for change the row height and the 'N' is the size. if so why don't change the row height?

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: [VB2010] - RTF format: how change row height?:(

    Open in WORDPAD to see the changes. RTF changes every few years. It was 600 pages 10 years ago. You can download it.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2009
    Posts
    1,355

    Re: [VB2010] - RTF format: how change row height?:(

    Quote Originally Posted by dglienna View Post
    Open in WORDPAD to see the changes. RTF changes every few years. It was 600 pages 10 years ago. You can download it.
    heres the result:
    Code:
    {\rtf1\ansi\ansicpg1252\deff0\deflang2070{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}\viewkind4\uc1\pard\f0\fs17\par
    \trowd\trgaph108\trleft36\cellx700\cellx1400\cellx2100\cellx2800\cellx3500\pard\intbl      \cell\cell\cell\cell\cell\row
    \intbl      \cell\cell\cell\cell\cell\row
    \intbl      \cell\cell\cell\cell\cell\row
    \intbl      \cell\cell\cell\cell\cell\row
    \intbl      \cell\cell\cell\cell\cell\row
    \pard\par
    }
    big question: where is the "\trrhN" command?

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: [VB2010] - RTF format: how change row height?:(

    Quote Originally Posted by Cambalinho View Post
    i have read that the "\trrhN" RTF command is for change the row height and the 'N' is the size. if so why don't change the row height?
    A quick observation showed me that your code should be fine. You do realize though that you must set the row height and width properties in Twips?

    A twip is 1/20 ( one twentyith ) of a point. 72 points are equal to one inch. Therefore 1440 twips are one inch (72 times 20)

    Also, have a look here :

    http://www.biblioscape.com/rtf15_spec.htm#Heading40

  5. #5
    Join Date
    Apr 2009
    Posts
    1,355

    Re: [VB2010] - RTF format: how change row height?:(

    Quote Originally Posted by HanneSThEGreaT View Post
    A quick observation showed me that your code should be fine. You do realize though that you must set the row height and width properties in Twips?

    A twip is 1/20 ( one twentyith ) of a point. 72 points are equal to one inch. Therefore 1440 twips are one inch (72 times 20)

    Also, have a look here :

    http://www.biblioscape.com/rtf15_spec.htm#Heading40
    heres the new code:
    Code:
    "\trowd \trgaph108 \trqc \ltrrow \trleft3 \trrh" & (RowHeight * row).ToString & " \trhdr \trkeep"
    and what the textbox show me:
    Code:
    {\rtf1\ansi\ansicpg1252\deff0\deflang2070{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}
    \viewkind4\uc1\pard\f0\fs17\par
    \trowd\trgaph108\trleft3\trqc\cellx700\cellx1400\cellx2100\cellx2800\cellx3500\pard\intbl      \cell\cell\cell\cell\cell\row
    \intbl      \cell\cell\cell\cell\cell\row
    \intbl      \cell\cell\cell\cell\cell\row
    \intbl      \cell\cell\cell\cell\cell\row
    \intbl      \cell\cell\cell\cell\cell\row
    \pard\par
    }
    i see 2 bad things
    1 - the cell have the standard height;
    2 - the textbox don't show me the "\trrh" comand

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured