Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 8th, 2006, 06:34 AM
Registered User
Join Date: Aug 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display Excel Workbook in browser

Hi All,

I need to display an excel workbook which has 2 sheets in a browser.
The issue is after displaying the 1st sheet, i do not know what to char to output which indicates that the data should now be displayed on a new sheet. Below is the code.

void TSMF::DownloadData(RCLString filename)
 cout << "Content-Type: application/vnd.ms- excel; filename=Statistics.xls\n";

 cout << "Content-Disposition: attachment; filename=Statistics.xls\n";
 cout << "\n";

 BasicExcel excelWorkbook;
 // Loads the excel workbook that i want to open or save

 size_t maxSheets = excelWorkbook.GetTotalWorkSheets();

 for (size_t i=0; i<maxSheets; ++i)
  // Pointer to the sheet
  BasicExcelWorksheet* sheet = excelWorkbook.GetWorksheet(i);
  if (sheet)
   size_t maxRows = sheet->GetTotalRows();
   size_t maxCols = sheet->GetTotalCols();

   for (size_t r=0; r<maxRows; ++r)
    for (size_t c=0; c<maxCols; ++c)
     cout << *(sheet->Cell(r,c)) << "\t";
     // "\t" is used so that the data read goes on a new cell
    cout << endl;
  /* here is where the issue is. as of now, im outputting "endl", so the next sheet data is being displayed on the same sheet with a blank line inserted in between */
  cout << endl;

Could somebody please tell me how to go about this issue?
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 workbook name qualifier AveryB Excel VBA 1 December 17th, 2007 10:41 PM
XPATH Help, Please- Excel XML Workbook jftaylor BOOK: XSLT Programmer's Reference, 2nd Edition 2 September 28th, 2006 08:47 PM
Import Excel data into a workbook Derek_05 Excel VBA 5 May 31st, 2006 02:02 PM
Closing Excel Workbook rekha_jsr Excel VBA 0 July 9th, 2005 02:40 AM
Saving Excel workbook with new filename tsegal20 Excel VBA 1 May 21st, 2004 01:55 PM

All times are GMT -4. The time now is 03:15 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.