5 Replies - 2473 Views - Last Post: 03 July 2011 - 04:37 AM Rate Topic: -----

#1 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 944
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Convert From Excel To Image

Posted 02 July 2011 - 02:10 PM

Do you guys know of any good libraries that can convert an excel file to an image? I've been searching the internet and the only way I'm seeing is from Excel to PDF to Image.
Is This A Good Question/Topic? 0
  • +

Replies To: Convert From Excel To Image

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5436
  • View blog
  • Posts: 11,651
  • Joined: 02-June 10

Re: Convert From Excel To Image

Posted 02 July 2011 - 02:56 PM

Thank kind of makes sense, since an Excel file can be several pages and several worksheets. So a PDF matches that same need:Several pages.

Making a single image of several tabs would have some issues.

But if you just have a simple one-tab workbook you could just print it to a JPG.
Was This Post Helpful? 0
  • +
  • -

#3 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 944
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Re: Convert From Excel To Image

Posted 02 July 2011 - 04:41 PM

View PosttlhIn`toq, on 02 July 2011 - 05:56 PM, said:

But if you just have a simple one-tab workbook you could just print it to a JPG.

It actually is one worksheet but the libraries I'm seeing cost a lot of bucks and I really only need it for one school project.

My problem originally is opening and displaying the contents of an excel file in my program. The best way a could think of is displaying it as an image in a picture box. Looks like it's a bit harder than I thought lol
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5436
  • View blog
  • Posts: 11,651
  • Joined: 02-June 10

Re: Convert From Excel To Image

Posted 02 July 2011 - 11:26 PM

View Postcodeprada, on 02 July 2011 - 05:41 PM, said:

My problem originally is opening and displaying the contents of an excel file in my program. The best way a could think of is displaying it as an image in a picture box. Looks like it's a bit harder than I thought lol


Opening Excel spreadsheets is built into .NET - I have no idea why you are trying to make a picture out of one, or why you are looking to purchase some 3rd part library for it when you already have it for free.

http://social.msdn.m...aa-e2ce9ec36380

Reminder to others: This is a homework assignment so no complete code solutions, please.
Was This Post Helpful? 0
  • +
  • -

#5 Jeff H  Icon User is offline

  • D.I.C Regular

Reputation: 112
  • View blog
  • Posts: 307
  • Joined: 30-January 11

Re: Convert From Excel To Image

Posted 03 July 2011 - 12:49 AM

Here is a start just start looking for finding the excel extents
Takes pic of whole moniter
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;


namespace ConsoleApplication23
{
    class Program
    {
        static void Main(string[] args)
        {
          Bitmap bmp = 
              new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height,
                  PixelFormat.Format32bppArgb);

          Graphics grph = Graphics.FromImage(bmp);

            grph.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y,
                0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);

            bmp.Save(@"C:\Test\Pic.png", ImageFormat.Png);
        }
    }
}




Was This Post Helpful? 1
  • +
  • -

#6 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 944
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Re: Convert From Excel To Image

Posted 03 July 2011 - 04:37 AM

Yes it is built into .NET no doubt about that but I'm designing a print preview for my program.

I actually got it to work from excel to pdf to bmp then I'll load the bmp in a picture box but I had to use two third party tools.

Read and writing wasn't the problem since my program generates that same excel file.

Just to give me a bit of insight. Could I have used the printpreview component to preview the document in my application because I really won't mind ditching the 3rd party libraries.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1