Thread: Printing a table-like text

  1. #1
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008

    Printing a table-like text

    I have a more generic question. There are some time I just want to print a table-like text. One word underneath the other etc. The thing is that tabs don't really function they way I want. They depend on the length of the word for example. You cannot align a word on the left of an imaginary cell either using tabs.

    I know this is something that will overly be used so I am guessing there is a nice simple way to do it. So if anybody has some code or can point to the right class that would be appreciated. I have used in the past some methods, but they were a bit messy....

    The program uses WPF and I found that you can print visually a control. Thus a Grid could do the trick. But I am not sure if this is the best method. What I would like is make a table, populate it and then just print it being able to maximize it on the best or not to have to measure all the cells-width to fit properly in an A4 page.


  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Oregon, USA
    I'm not sure I really understand what you're looking for. I'm confused as to how tabs fit in here. What is wrong with a grid or table?

    This is also confusing me:
    print it being able to maximize it on the best or not to have to measure all the cells-width to fit properly in an A4 page.
    If you understand what you're doing, you're not learning anything.

  3. #3
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    I know this is a broad statement, but...
    Write a container class to hold your table.
    Then write a header class to format the header data.
    Then write a row class that controls all the row formating.
    Finally write a cell class that controls all your cell formating.
    This should only take you one day of work if you really focus on it.
    Have you looked at mvc and jquery yet?
    The have some cool new .net functionality that could do this for you if you are not into building from scratch.
    Why reinvent the wheel.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. printing a text file
    By j_spinto in forum C Programming
    Replies: 13
    Last Post: 06-25-2005, 05:33 PM
  2. MUD Concept Question
    By mrpickle in forum Game Programming
    Replies: 3
    Last Post: 12-01-2003, 12:45 PM
  3. inputting words from a file
    By kashifk in forum C++ Programming
    Replies: 5
    Last Post: 10-24-2003, 07:18 AM
  4. About the Morse code Converter
    By Amber_liam in forum C Programming
    Replies: 17
    Last Post: 05-29-2002, 08:35 AM
  5. Printing characters not in the ASCII table
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 01-21-2002, 01:47 PM