[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

CSS File Embedded on an Excel Spreadsheet

Posted on 2006-06-08
7
Medium Priority
?
496 Views
Last Modified: 2008-01-09
ColdFusion - Excel - CSS

I have created a report using an Excel spreadsheet, converted it into a ColdFusion Template and populated it.  The problem is the cell formatting (colors, font,etc) is all done in a CSS file.  Is there any way to export such that the CSS is embedded (or something) so I don't lose the coloring or I don't have to go and apply the colors directly to each cell?

I am using the following link on my head tags:

<head>

   <link rel="stylesheet" type="text/css" href="excel.css">
   <cfheader name="content-disposition" value="attachment; filename=test.xls">
   <CFCONTENT TYPE="application/vnd.ms-excel"></cfcontent>

</head>
0
Comment
Question by:jramos74
  • 4
  • 3
7 Comments
 
LVL 30

Accepted Solution

by:
GrandSchtroumpf earned 1500 total points
ID: 16863774
In real HTML+CSS, you can place the content of the excel.css file inside a <style> tag:

<head>

   <cfheader name="content-disposition" value="attachment; filename=test.xls">
   <CFCONTENT TYPE="application/vnd.ms-excel"></cfcontent>
   <style type="text/css">
      { content goes here}  
   </style>

</head>

Now, since this is excel, i cannot guarantee that it will work.
0
 

Author Comment

by:jramos74
ID: 16866424
THe content of my css file was inside the style tag, but I have so many styles and settings so I decided to put all the styles on a separate file.  

I have done this before with Word and it work perfectly.  I am not sure why it will not work for Excel.
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 16866509
Well, you need to choose, either you embed it or you don't... you cannot do both at the same time.
You can keep the css in a separate file you your server and just include it using a CF function.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jramos74
ID: 16867045
That is what I did.  I put all the styles on one .css file.  When I try to use it above, it will not recognize the file.
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 16868568
You used a <link> tag which is the HTML way to include an external CSS file.
You need to include the CSS using a CF include... something like this:

<head>

   <cfheader name="content-disposition" value="attachment; filename=test.xls">
   <CFCONTENT TYPE="application/vnd.ms-excel"></cfcontent>
   <style type="text/css">
      <cfinclude template="excel.css">
   </style>

</head>
0
 

Author Comment

by:jramos74
ID: 16875391
I did exactly what you coded above. When I run the template I did not get the styles and settings instead it outputed the code inside the .css file.  I will keep on trying other ways.  Thank you Grandschtroumpf for your help.  I am not familiart with CSS that much.  If you have another suggestions, I would love to try it.  Worst case, I will just embed the styles inside the style tags.  I just want to make my template much easier to read.  That is why I am putting the styles on a separate file.
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 16876144
> I did not get the styles and settings instead it outputed the code inside the .css file.
That's definitely not what i expected from <cfinclude>...
I never used Cold Fusion, but it relly seems like <cfinclude> is for including files:
http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p63.htm
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses
Course of the Month19 days, 1 hour left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question