Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Creating Excel File -- Autofit cells

Creating Excel File -- Autofit cells

Scheduled Pinned Locked Moved C / C++ / MFC
databasecomhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shultas
    wrote on last edited by
    #1

    Hi all. I am using a class found here http://www.codeproject.com/database/cspreadsheet.asp to create an excel spreadsheet ( i believe it uses ODBC ) It works great except I cannot, from my code, get the cells to autofit. That is, when you load up the file in Excel, a lot of the contents of the cells get cut off, because the cell is not big enough. I need to be able to tell it to autofit (automatically through code) or be able to specify the width of each column of cells. If I bring up the file in excel, and select all of the cells, then click on Column->Autofit, it makes it look right instantly ... However, I am planning on rolling out a program that generates reports and I don't want to have to tell the users that they have to do this every time they open a report. Any help in the right direction would be appreciated! -Shultas

    F 1 Reply Last reply
    0
    • S shultas

      Hi all. I am using a class found here http://www.codeproject.com/database/cspreadsheet.asp to create an excel spreadsheet ( i believe it uses ODBC ) It works great except I cannot, from my code, get the cells to autofit. That is, when you load up the file in Excel, a lot of the contents of the cells get cut off, because the cell is not big enough. I need to be able to tell it to autofit (automatically through code) or be able to specify the width of each column of cells. If I bring up the file in excel, and select all of the cells, then click on Column->Autofit, it makes it look right instantly ... However, I am planning on rolling out a program that generates reports and I don't want to have to tell the users that they have to do this every time they open a report. Any help in the right direction would be appreciated! -Shultas

      F Offline
      F Offline
      f64
      wrote on last edited by
      #2

      Hi ODBC, ADO or OLEDB will only allow you to manipulate data in and out Excel files, to go beyond that, you should use Automation, then you will be able to do, programmatically, anything you have to do. You can take a look here to start, SAMPLE: XLCLIENT: Automation Client for Excel, also search the MSDN for more info. Fabian

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups