html to excel

G

Guest

Hello. I have an application that we export database data to an XML file.
We use an xsl style sheet to convert that to .html that the application or a
web page can use to display to the user. An option we allow for the users is
to convert the html document to excel for editing or converting to PDF. One
issue we have is that the document can contain text in the form of 05/12 or
0512 that we need to stay as text.

In the html document they are correct, however, excel turns them into dates
or numbers. I've tried putting the ' character in front of the string.
However, when excel gets the html, it puts it in (ex: '05/12) and doesn't
hide the ' character until the cell is clicked on and OKd (but this is not an
option as there are too many cells). I was wondering if there was some tag I
could put in the html document (via the style sheet) that would tell excel to
not format the numbers. Or if there was something I could put in the html
that would tell excel to turn off all formatting.

Excel 2002
Windows XP

Thanks. And if anyone needs more info let me know.

nellie.
 
M

Mark E. Philpot

Hi,
I have just written a utility that "might" be able to do
whaat you want.

EasyText_Rev1.xls

http://www.geocities.com/excelmarksway

When you open the xls file, Click the picture to start the
form.

Click the open button, then select your file. The contents
of your file is loaded into a text box.

Another button can insert those contents into a cell in
the worksheet. Otherwise you can click the "Select All"
label, "Copy All Text", then hide EasyText, then select a
cell in the worksheet and ctr+v, or use your worksheet
paste. This will paste the contents to the worksheet, not
just the cell (depends if carriage returns are used in the
contents).


- Mark

- Mark
 
G

Guest

Sorry for the delay. I was working on something else and figured I would get
e-mailed any response. I think my filters might have sent it to a junk
folder. Oh well, enought about that.

I tried the program and it didn't seem to work for me. It put all the
contents into one cell. It is probably just the way my html and XML are
constructed. But here is a snip of what the html looks like(this HTML is
built using a XML file and Style Sheets):

<head><style TYPE="text/css">
table.TitleInfo
{
font-weight: bold;
text-align: left;
width: 100%;
}
table.schedule
{
border: 1px;
border-style: solid;
border-color: black;
border-collapse: collapse;
empty-cells: show;
}
td.value
{
text-align: left;
border: 1px;
border-style: solid;
border-color: black;
border-collapse: collapse;
}
</style></head>
<body><table class="TitleInfo"><tr><td>My Company,
Inc.</td></tr><tr><td>Schedule for</td></tr><tr><td>Our
Customer</td></tr></table><br /><table class="schedule"><tr><td
class="section">ISSUE NAME</td><td
class="value">SUPPLEMENTAL</td></tr><tr><td class="operation">JOB
NUMBER</td><td class="value">Job123</td></tr><tr><td
class="section">BATCH/FORM #</td><td class="value">05/12</td></tr>

and then it continues on with different information. But my problem is the
"05/12" is not a date, but excel handles it as a date. I've tried the '
character, but excel doesn't hide it (although then it just displays at
'05/12 which is better then 05/12/2005). My other option is to just put ""
around the strings, but that is a last resort.

Maybe this will help out more.

Thanks

mark.
 
G

Guest

OK. I came up with something that has seemed to initially work. If I add:
style="vnd.ms-excel.numberformat:Text" to the <td> then i'm able to get it
to work. I can do this through my style sheet so every cell gets this
formatting.

thanks for any help that anyone may have put into this.

mark.
 
G

Guest

Sorry to post again, but just wanted to make a correction. I replaced Text
with @. Text was doing some funky things in certain situations.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top