Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

MS Datagrid printing

Posted on 2000-04-06
6
343 Views
Last Modified: 2013-11-20
Hi experts,

I have a VC++ app with a MS datagrid 6.0 control.

How can I print the contents of the grid easily?

Please insert code samples. (And don't tell me to look at codeguru)


Thanks in advance!
0
Comment
Question by:MelissaC
  • 3
  • 3
6 Comments
 
LVL 2

Author Comment

by:MelissaC
ID: 2699948
Adjusted points from 50 to 300
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 300 total points
ID: 2824024
Hi,
I can't find an easy way.  I need to implement that same function in one of my projects, but it's low priority right now.

I found this:

http://support.microsoft.com/support/kb/articles/Q96/9/41.asp

....which is basically "check each cell and print its text" and it uses the VB Print object, anyway.  This in not a bad way to go -- and it's probably what I'll end up with because I don't need a lot of flexibiliyt (colors, fonts, pagination, etc) -- since you have total control, but it's not a canned answer by any means.

Another method is shown at:

http://www.deja.com/usenet/

if you search for

MSFlexGrid and print

That one uses the idea of resizing the control so all its cells are "visible" then asking the control to paint itself, passing it your own HDC.  You can scale the result and print it.

* How big is your grid?

* Is it a dlgbox control or are you putting it in a View?

* If Ms Word or Excel is known to be available (ie, corporate setting), you could explore the idea of passing the data into one of these objects, since they both support IPrint.

-- dan










http://x44.deja.com/getdoc.xp?AN=621241931&CONTEXT=958695773.773062669&hitnum=16


0
 
LVL 49

Expert Comment

by:DanRollins
ID: 2886188
Melissa,
r u there?
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 2

Author Comment

by:MelissaC
ID: 3221470
Hi Dan,

Sorry to keep you waiting. I was on a holiday, isn't that terrible!
Anyway, I think I'll use Excel automation and let Excel do the dirty work for me. The HDC-stuff also looks nice, but I think my grid contains to much data to do that. I'll keep it in mind for future projects though.
Anyway, which solution will you be using for your project?

Thanks very much,
Melissa
0
 
LVL 2

Author Comment

by:MelissaC
ID: 3221490
Comment accepted as answer
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 3290850
Thanks!
I've settled on the simple "examine and print each cell" .  I just use a fixed-width font and use spacing to line up the cells.  Simple is often best.

-- dan
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question