473,624 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strip css from Excel-generated file


I need to pull several tables of data from Excel into a web page, but
when I use Excel's "Save as web page" function, I get an enormous file
containing a massive amount of css formatting. I'd like to strip out
this css so that I can apply my own style sheet; does anyone know
whether there is a way to do this, other than manually? Either a way to
export the data from Excel that doesn't include the css formatting, or
a utility that will strip it out for me?

Julie
--
Never ascribe to malice that which can be
adequately accounted for by stupidity
Jul 20 '05 #1
9 8888
On Thu, 23 Oct 2003 10:29:30 -0600, Julie Miles wrote:

I need to pull several tables of data from Excel into a web page, but
when I use Excel's "Save as web page" function, I get an enormous file
containing a massive amount of css formatting. I'd like to strip out
this css so that I can apply my own style sheet; does anyone know
whether there is a way to do this, other than manually? Either a way to
export the data from Excel that doesn't include the css formatting, or
a utility that will strip it out for me?


Quick response:

I don't have Excel, but on Word (XP at least) you can choose File --> Save
As --> Save As Type. There's Web Page and under that something like "Web
Page <something>" which doesn't add the M$ Office Bloat.

--
Matt
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #2
On Thu, 23 Oct 2003 10:29:30 -0600, Julie Miles <jm****@unibase .com>
wrote:

I need to pull several tables of data from Excel into a web page, but
when I use Excel's "Save as web page" function, I get an enormous file
containing a massive amount of css formatting. I'd like to strip out
this css so that I can apply my own style sheet; does anyone know
whether there is a way to do this, other than manually? Either a way to
export the data from Excel that doesn't include the css formatting, or
a utility that will strip it out for me?


Simplest way is probably as follows. Insert new columns around the
existing columns: the first containing <TR><TD>, the last with
</TD></TR> and all the others with </TD><TD>. Obviously the Excel "fill
down" function is very handy. Save the file as text. That gets most of
the work done.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #3
In article <pa************ *************** *@hotmail.com>,
ma**********@ho tmail.com says...
On Thu, 23 Oct 2003 10:29:30 -0600, Julie Miles wrote:

I need to pull several tables of data from Excel into a web page, but
when I use Excel's "Save as web page" function, I get an enormous file
containing a massive amount of css formatting. I'd like to strip out
this css so that I can apply my own style sheet; does anyone know
whether there is a way to do this, other than manually? Either a way to
export the data from Excel that doesn't include the css formatting, or
a utility that will strip it out for me?


Quick response:

I don't have Excel, but on Word (XP at least) you can choose File --> Save
As --> Save As Type. There's Web Page and under that something like "Web
Page <something>" which doesn't add the M$ Office Bloat.

Thanks, Matt, but there doesn't seem to be any corresponding function
in Excel. I think the simplest way around this might be to convert the
file to .pdf rather than an html page.

--
Never ascribe to malice that which can be
adequately accounted for by stupidity
Jul 20 '05 #4
In article <7n************ *************** *****@4ax.com>,
sb*****@xs4all. nl says...
On Thu, 23 Oct 2003 10:29:30 -0600, Julie Miles <jm****@unibase .com>
wrote:

I need to pull several tables of data from Excel into a web page, but
when I use Excel's "Save as web page" function, I get an enormous file
containing a massive amount of css formatting. I'd like to strip out
this css so that I can apply my own style sheet; does anyone know
whether there is a way to do this, other than manually? Either a way to
export the data from Excel that doesn't include the css formatting, or
a utility that will strip it out for me?


Simplest way is probably as follows. Insert new columns around the
existing columns: the first containing <TR><TD>, the last with
</TD></TR> and all the others with </TD><TD>. Obviously the Excel "fill
down" function is very handy. Save the file as text. That gets most of
the work done.

That's an ingenious suggestion! I think it will work for most of them -
there are some that have more complex structures (merged cells), but it
certainly gets rid of the majority of the grunt work. Thanks!

Julie
--
Never ascribe to malice that which can be
adequately accounted for by stupidity
Jul 20 '05 #5
Julie Miles wrote:

I need to pull several tables of data from Excel into a web page, but
when I use Excel's "Save as web page" function, I get an enormous
file containing a massive amount of css formatting. I'd like to strip
out this css so that I can apply my own style sheet; does anyone know
whether there is a way to do this, other than manually? Either a way
to export the data from Excel that doesn't include the css
formatting, or a utility that will strip it out for me?


Next to the <tr><td> hack which is very good, you can use Tidy HTML.
It's got special functions to clean Word-bloat etc. but it basically
cleans up any HTML, converts to XHTML etc.
http://www.w3.org/People/Raggett/tidy/
--
Google Blogoscoped
http://blog.outer-court.com
Jul 20 '05 #6
Wow, I remember that someone wrote a DeCSS program to remove CSS from web
pages. (OK it was mainly to confuse 'bots looking for some other DeCSS
program). This might be an actual use for it.

Julie Miles wrote:

I need to pull several tables of data from Excel into a web page, but
when I use Excel's "Save as web page" function, I get an enormous file
containing a massive amount of css formatting. I'd like to strip out
this css so that I can apply my own style sheet; does anyone know
whether there is a way to do this, other than manually? Either a way to
export the data from Excel that doesn't include the css formatting, or
a utility that will strip it out for me?

Julie


Jul 20 '05 #7
Julie Miles <jm****@unibase .com> wrote:
I need to pull several tables of data from Excel into a web page,
but when I use Excel's "Save as web page" function, I get an
enormous file containing a massive amount of css formatting.


There are several approaches, some of which have been mentioned here.
I'd like to add two more:

1. Save in TSV format (tab separated values) and use some simple
utilitity like a short Perl script to convert the TSV file
to simple HTML markup. More on this:
http://www.cs.tut.fi/~jkorpela/TSV.html

2. Download Office 2000 Filter from Microsoft:
<http://www.microsoft.com/downloads/details.aspx?
FamilyID=209ADB EE-3FBD-482C-83B0-96FB79B74DED&di splaylang=EN>
For Excel files, you would run the filter from the Start menu,
item Microsoft Office Tools. In the program, click on the
Options button to make it string standard CSS too (it by
default strips Microsoft-specific CSS only).
Problem: It leaves HTML attributes intact, making the table
foolishly rigid. You could use some other software on it,
or just try to override those attributes using CSS (e.g.,
overriding a pixel-valued width or height attribute with
a CSS rule that uses the em unit or the value 'auto').

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #8
On Thu, 23 Oct 2003 13:17:46 -0600, Julie Miles <jm****@unibase .com> wrote:

[snip]
Simplest way is probably as follows. Insert new columns around the
existing columns: the first containing <TR><TD>, the last with
</TD></TR> and all the others with </TD><TD>. Obviously the Excel "fill
down" function is very handy. Save the file as text. That gets most of
the work done.

That's an ingenious suggestion! I think it will work for most of them -
there are some that have more complex structures (merged cells), but it
certainly gets rid of the majority of the grunt work. Thanks!

Julie


Several months ago I wrote an Excel function for this purpose: It can
handle merged cells and it reads the names(!) of Excel styles (not the
style definitions) and translates them into CSS class attributes.

To make it work, paste the following code into an Excel module (Fire the
VBA editor with Alt + F11, find your workook in one of the left windows,
right-click on it, then "Insert - Module" , doubleclick the newly created
module and paste the code).

If the first line of your Excel table stretches from A1 to D1, then in E1
you could use the formula =row2html(A1:D1 )
Copy the formula down to the last cell.

Cheers,
Joerg

Here comes the Excel Stuff:
Function row2html(DataRa nge As Object)
'Purpose: To mark-up a horizontal cell range as HTML <tr><td> elements
'How it works: Each cell contents enclosed with <td>..</td> tags. The
whole stuff with <tr>..</tr> tags.
'Special functions: Reads style names and converts them to class
attributes, translates merged cells into colspans.
'Applies to: Horizontal cell ranges
On Error Resume Next
Dim CellText As String
Application.Vol atile
txt = "<tr>"
'If DataRange.Merge Cells = True Then MsgBox "contains merged cells"
Colspan = 0
For Each cell In DataRange
ColSpanAttribut e = ""
If cell.MergeArea. Address <> cell.Address And ColSpanProcesse d =
True Then
'Do nothing if cell is part of a merged area and TD with
COLSPAN attribute has already been defined
'Ignore cell until last cell reached, then reset
ColSpanProcesse d (another merged area may follow and has to be processed
with a clean slate)
Colspan = Colspan - 1
If Colspan = 1 Then ColSpanProcesse d = False
Else
'Define COLSPAN if cell is part of merged area
If cell.MergeArea. Address <> cell.Address And ColSpanProcesse d
= False Then
Colspan = cell.MergeArea. Cells.Count
ColSpanAttribut e = " colspan=""" & Colspan & """"
ColSpanProcesse d = True
End If

CellText = cell.Value
'Add CSS class names, if cell contains named style
If cell.Style.Name = "Normal" Then
txt = txt & "<td" & ColSpanAttribut e & ">" & CellText &
"</td>"
Else
txt = txt & "<td class=""" & cell.Style.Name & """" &
ColSpanAttribut e & ">" & CellText & "</td>"
End If
End If
Next cell
txt = txt & "</tr>"
row2html = txt
End Function
Jul 20 '05 #9
In article <Xn************ *************** **@193.229.0.31 >,
jk******@cs.tut .fi says...
Julie Miles <jm****@unibase .com> wrote:
I need to pull several tables of data from Excel into a web page,
but when I use Excel's "Save as web page" function, I get an
enormous file containing a massive amount of css formatting.


There are several approaches, some of which have been mentioned here.
I'd like to add two more:

1. Save in TSV format (tab separated values) and use some simple
utilitity like a short Perl script to convert the TSV file
to simple HTML markup. More on this:
http://www.cs.tut.fi/~jkorpela/TSV.html

2. Download Office 2000 Filter from Microsoft:
<http://www.microsoft.com/downloads/details.aspx?
FamilyID=209ADB EE-3FBD-482C-83B0-96FB79B74DED&di splaylang=EN>
For Excel files, you would run the filter from the Start menu,
item Microsoft Office Tools. In the program, click on the
Options button to make it string standard CSS too (it by
default strips Microsoft-specific CSS only).
Problem: It leaves HTML attributes intact, making the table
foolishly rigid. You could use some other software on it,
or just try to override those attributes using CSS (e.g.,
overriding a pixel-valued width or height attribute with
a CSS rule that uses the em unit or the value 'auto').


Thanks to everyone for your helpful and creative suggestions - I truly
appreciate the help!

Julie
--
Never ascribe to malice that which can be
adequately accounted for by stupidity
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
2824
by: | last post by:
Could some help m figure out to strip an unknown range of characters in a path between the first "/" and "/" found in a folder path somewhere on my site. eg: /catamaranco/sales/boat/1.asp eg: /esserman/newseltter/2004/03/ eg: /yachtservices/excel/reports/ I wish to return only:
2
2770
by: Gustavo Randich | last post by:
Hello, (Using DB2/LINUX 8.2.0) After compiling the STRIP migration UDF (found at http://www-106.ibm.com/developerworks/db2/library/samples/db2/0205udfs/), if I try to execute: values char(STRIP('0000345.50','L','0'),20) @
5
8714
by: dan.j.weber | last post by:
I'm using Python 2.3.5 and when I type the following in the interactive prompt I see that strip() is not working as advertised: >>>s = 'p p:p' >>>s.strip(' :') 'p p:p' Is this just me or does it not work? I want to get rid of all ' ' and ':' in the string. I've checked the doc and from what I can tell this is what strip() is supposed to do. Thanks for any help.
6
2561
by: rtilley | last post by:
s = ' qazwsx ' # How are these different? print s.strip() print str.strip(s) Do string objects all have the attribute strip()? If so, why is str.strip() needed? Really, I'm just curious... there's a lot don't fully understand :)
2
4506
by: Jared | last post by:
Hi I have been trying to find an easy way to strip the hyperlinks out of an html string to make exporting ASP.NET GridView's to Excel a bit more user friendly. Couldn't find anything in these groups, so I have written this code which will work fine as long as you don't use the ">" character in your hyperlink name. Hope somebody finds it useful.
6
2350
by: eight02645999 | last post by:
hi can someone explain strip() for these : 'example' when i did this: 'abcd,words.words'
15
22227
by: justinf | last post by:
Hello! I'm looking for help on how to strip time data of my date string. The information in each field is extracted from another type database into access. For example: 12/31/2007 12:34:56:789 2/2/2007 00:00:00 I would want to be 12/31/2007 2/2/2007 Another problem is that the dates are different sizes ranging from 8-10 Characters long. I've tried using left/right/len and replace functions. As well as Sql statements to adjust...
3
2362
by: Colin J. Williams | last post by:
The Library Reference has strip( ) Return a copy of the string with the leading and trailing characters removed. The chars argument is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a
6
4128
by: Christoph Zwerschke | last post by:
In Python programs, you will quite frequently find code like the following for removing a certain prefix from a string: if url.startswith('http://'): url = url Similarly for stripping suffixes: if filename.endswith('.html'): filename = filename
4
2284
by: Poppy | last post by:
I'm using versions 2.5.2 and 2.5.1 of python and have encountered a potential bug. Not sure if I'm misunderstanding the usage of the strip function but here's my example. var = "detail.xml" print var.strip(".xml") ### expect to see 'detail', but get 'detai' var = "overview.xml" print var.strip(".xml") ### expect and get 'overview' I have a work around using the replace function which happens to be the
0
8233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8675
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2604
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.