CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 MS Excel import formatting from grid

Print topic Send  topic

Author Message
TonyReid


Posts: 159
Posted: 06/18/2007, 3:27 AM

I'm using the example pack code to export a grid to Excel (thanks for pointing me in the right direction - pruiz & Walter)

It works great - But I have one problem.

Upon import - the worksheet in Excel has no grid at all - its just plain white.... has anyone else managed to recover the grid?

I've tried removing all the CSS - but to no avail :(


_________________
-----------
PHP/indy Game Developer - http://www.AbsoluteBreeze.co.uk
View profile  Send private message
Wkempees
Posted: 06/18/2007, 3:55 AM

First, make sure (as if you not already did) that each piece of data is
indeed in its own cell and not all datat in one cell (big white area) lol.

In fact the data you feed into excel is put in rows/cells.
Excel has its own way of displaying separators, cell/row borders.
That is in the worksheet properties and/or even in the printsetup.

You should see the basic thin lines between cells and rows though,
if not that could be in your Execl basic setup.
All the answers I could think of given your details.

Walter
TonyReid


Posts: 159
Posted: 06/18/2007, 4:27 AM

Yeah - its all in columns and rows as it should be.

I've also looked at the page setup but nothing there helps.

Here is a screenshot....



_________________
-----------
PHP/indy Game Developer - http://www.AbsoluteBreeze.co.uk
View profile  Send private message
TonyReid


Posts: 159
Posted: 06/18/2007, 4:31 AM

I just noticed the dates are coming across as plain text(not date) too - perhaps this has something to do with it?

Im wondering if I should squirt in some formatting codes somehow?
_________________
-----------
PHP/indy Game Developer - http://www.AbsoluteBreeze.co.uk
View profile  Send private message
wkempees


Posts: 1679
Posted: 06/18/2007, 5:18 AM

From the screenshot, it looks dazzling ok to me.
I can see no real problem, data is distributed nicely.
As to formating, everything is exported as text.
You might have to take a look at the Excel basics as to indicating text/numbers in cells.
From the back of my head numbers/formulas should be '=' prefixed, dunno about dates.
Besides that formatting them in CCS would help Excel predict datefield.
Go on and tell us (sorry)

Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
Damian Hupfeld
Posted: 06/18/2007, 5:45 AM

I just checked a page that I use Export To Excel and it exhibits the same
behaviour as far as the "no grid" goes except that really the grid is
there - it just doesnt have defined borders. All the cells work fine -
although I havent used dates before... I do remember something about dates
and exporting to excel....


"TonyReid" <TonyReid@forum.codecharge> wrote in message
news:546766d22e8f35@news.codecharge.com...
>I just noticed the dates are coming across as plain text(not date) too -
>perhaps
> this has something to do with it?
>
> Im wondering if I should squirt in some formatting codes somehow?
> _________________
> Using: CodeCharge Studio 3.0 - IIS, PHP and MSSQL
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

JimmyCrackedCorn

Posts: 583
Posted: 06/18/2007, 11:04 AM

This is an Excel issue as opposed to a CCS one.

First it helps to understand how CCS "exports" to Excel. When you select export to Excel, CCS actually creates an HTML file with a table of rows and columns containing your data. It saves this with an XLS extension. When you open this HTML file in Excel it appears as a spreadsheet because that's how Excel handles an HTML file!

But when Excel opens an HTML file it turns off its grid because it wants to retain any formatting in the HTML file and not show the grid along with that formatting. Makes sense if you think about it.

To turn the grid back on go to Tools, Options and select the View tab. Under Window options make sure Gridlines is ticked. Now your Excel file looks normal!


This is a neat CCS feature. After experimenting with it and figuring out how it works I think it has lots of potential. To understand it better just copy the following text (not CCS...just plain old HTML) and then paste it into a Notepad file. Save it with an XLS extention and then open in Excel. In this example Excel correctly assigns cell formatting for the currency and date fields.


<html>  
<head>  
<title>Untitled Document</title>  
</head>  
<body>  
<table>  
  <tr>  
    <th>Company</th>  
    <th>Sales</th>  
    <th>Date Started </th>  
  </tr>  
  <tr>  
    <td>ABC, Inc. </td>  
    <td>$55,000</td>  
    <td>4/14/2005</td>  
  </tr>  
  <tr>  
    <td>XYZ, Inc. </td>  
    <td>$23,000</td>  
    <td>2/2/2000</td>  
  </tr>  
</table>  
</body>  
</html>  

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
Damian Hupfeld
Posted: 06/18/2007, 5:02 PM

Another tip - particularly if your exported file has lots of data - once you
download/export the file and open it in Excel - immediately do a Save As and
change the Type to "Microsoft Excel Workbook" as this converts it to a true
excel file and it will be much faster to work with.


"JimmyCrackedCorn" <JimmyCrackedCorn@forum.codecharge> wrote in message
news:54676c935d2fa6@news.codecharge.com...
> This is an Excel issue as opposed to a CCS one.
>
> First it helps to understand how CCS "exports" to Excel (which it really
> does
> not do!) When you select export to Excel, CCS actually creates an HTML
> file with
> a table of rows and columns containing your data. It saves this by default
> with
> an XLS extension. When you open this HTML file in Excel it appears as a
> spreadsheet because that's how Excel handles an HTML file!
>
> But when Excel opens an HTML file it turns off its grid because it wants
> to
> retain any formatting in the HTML file and not show the grid along with
> that
> formatting. Makes sense if you think about it.
>
> To turn the grid back on go to Tools, Options and select the View tab.
> Under
> Window options make sure Gridlines is ticked. Now your Excel file looks
> normal!
>
>
> This is a neat CCS feature. After experimenting with it and figuring out
> how it
> works I think it has lots of potential. To understand it better just copy
> the
> following text (not CCS...just plain old HTML) and then paste it into a
> Notepad
> file. Save it with an XLS extention and then open in Excel.
>
>
>
<html>  
> <head>  
> <title>Untitled Document</title>  
> </head>  
> <body>  
> <table>  
>  <tr>  
>    <th>Company</th>  
>    <th>Sales</th>  
>    <th>Date Started </th>  
>  </tr>  
>  <tr>  
>    <td>ABC, Inc. </td>  
>    <td>$55,000</td>  
>    <td>4/14/2005</td>  
>  </tr>  
>  <tr>  
>    <td>XYZ, Inc. </td>  
>    <td>$23,000</td>  
>    <td>2/2/2000</td>  
>  </tr>  
> </table>  
> </body>  
> </html>  
> 
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

TonyReid


Posts: 159
Posted: 06/19/2007, 2:47 AM

Thanks everyone.

It appears that this way is not going to work for us.

Unfortunately as its HTML - amongst other things, MS Excel refuses to run the macros that allow us to save it into our document management system.

I am going to see if I can generate a clean CSV file instead.

Thanks again,
Tony


_________________
-----------
PHP/indy Game Developer - http://www.AbsoluteBreeze.co.uk
View profile  Send private message
TonyReid


Posts: 159
Posted: 06/19/2007, 6:00 AM

arghhh.... this is driving me insane.

The only way I can work out how to do this is to bypass codecharge completely and have a small php script do it.

It would be really nice to have a function in codecharge though.... has anyone else been down this road?


_________________
-----------
PHP/indy Game Developer - http://www.AbsoluteBreeze.co.uk
View profile  Send private message
Damian Hupfeld
Posted: 06/19/2007, 6:18 AM

Did you try and "Save As... Microsoft Excel Workbook"?
Once you do this you should be able to perform all Excel functions.


"TonyReid" <TonyReid@forum.codecharge> wrote in message
news:54677d3698212c@news.codecharge.com...
> arghhh.... this is driving me insane.
>
> The only way I can work out how to do this is to bypass codecharge
> completely
> and have a small php script do it.
>
> It would be really nice to have a function in codecharge though.... has
> anyone
> else been down this road?
>
>
> _________________
> Using: CodeCharge Studio 3.0 - IIS, PHP and MSSQL
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

TonyReid


Posts: 159
Posted: 06/19/2007, 6:21 AM

Yes - 'save as' does not work for us because Excel has been modified to only save into our document management system.

Its a pain in the butt.




_________________
-----------
PHP/indy Game Developer - http://www.AbsoluteBreeze.co.uk
View profile  Send private message
JimmyCrackedCorn

Posts: 583
Posted: 06/19/2007, 3:25 PM

Quote TonyReid:
Yes - 'save as' does not work for us because Excel has been modified to only save into our document management system.

Its a pain in the butt.
no new ideas. sounds like the problem/limitation is in your doc mgmt system though.

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.