Announcement

Collapse
No announcement yet.

How to Print With Embedded Tabs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to Print With Embedded Tabs

    I have a richedit control with embedded tabs in the content, placed there by using the Ctrl-I shortcut. When I print, the printer prints a symbol for the tabs, rather than expanding the tabs.

    This example shows the same result on a simple string with $tabs in it.

    Code:
    #Compile Exe
    Function PBMain () As Long
        Local temp$
        temp$ = "this is a test" + $Tab + $Tab + "this is the end of the test
        XPrint Attach Default
        XPrint temp$
        XPrint FormFeed
    End Function
    In the past, I have rarely used tabs, except in Print statements with columns of variables. But here, where the tabs are simply content within a richedit control, I don't have the content split between variables.

    I suppose I could print line by line, check the position of each $Tab, then selectively expand the tabs to spaces, to widen the text to the next preferred tab spot (10, 20, ... or whatever I chose). That seems like an excessive solution. Plus, it only works for fixed width fonts.

    How are embedded tabs usually handled with XPrint? It seems like a common enough task, but my forum search didn't turn up similar questions.
    Last edited by Gary Beene; 10 Aug 2009, 02:34 PM.

  • #2
    You can use the DrawTextEx() API.
    The DRAWTEXTPARAMS structure will let you set the tab offset.
    hellobasic

    Comment


    • #3
      >Plus, it only works for fixed width fonts.

      Actually, any drawing command which supports tabstops works regardless of font.

      It's trying to use tab-stopped text with a proportional font which is Sysyphusian.

      MCM
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Let's not forget the printing capabilities a richedit control provides.
        hellobasic

        Comment

        Working...
        X