?
Solved

CSS for an aspx page of (application/vnd.ms-excel)

Posted on 2006-11-22
13
Medium Priority
?
712 Views
Last Modified: 2008-02-01
Experts;

I have an aspx page of content-type of application/vnd.ms-excel; I am displaying a Table in this page as an excel sheet

I need to format the display of this table (Color; Alignment; width,..etc) I tryed to use a css file but it is not working

any ideas??

Thanks
0
Comment
Question by:mmalaka
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
13 Comments
 
LVL 6

Expert Comment

by:bigphuckinglizard
ID: 18001907
you need to put the css styles inline in the head section e.g.

<html><head>
<title>Hello</title>
<style>
.red { color: red; font-size: 30px }
.blue { color: blue; font-weight: bold }
.green { color: green; text-decoration: underline }
</style>
</head>
<body>
<table>
<tr>
<td class="red">Red</td>
<td class="green">Red</td>
<td class="blue">Red</td>
</tr>
</table>
</body>
0
 

Author Comment

by:mmalaka
ID: 18002011

I tryed that already, but it is not working; I think coz I am building the HTML table at runtime

No It is not working :(

0
 
LVL 6

Expert Comment

by:bigphuckinglizard
ID: 18002015
i tested that and it works with excel 2003. post your code.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:mmalaka
ID: 18002019
this is my HTML code

<%@ Page language="c#" Codebehind="Excel_Report.aspx.cs" AutoEventWireup="false" Inherits="Lgcsb.Gis.CB.Excel_Report" contentType="application/vnd.ms-excel" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
      <HEAD>
            <TITLE>QueryForm</TITLE>
            <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
            <meta name="CODE_LANGUAGE" Content="C#">
            <meta name="vs_defaultClientScript" content="JavaScript">
            <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
            
            <style>


.QueryForm
{
      border-right: black thin solid;
      table-layout: auto;
      border-top: black thin solid;
      border-left: black thin solid;
      border-bottom: black thin solid;
      border-collapse: collapse;
}

.header
{
      border-right: black thin;
      border-top: black thin;
      font-size: smaller;
      border-left: black thin;
      color: white;
      border-bottom: black thin;
      font-family: Verdana, Sans-Serif;
      background-color: #00659c;
      text-align: left;
}

.Address
{
      color: white;
      background-color: #8db6cc;
      text-align: left;
      font-size: smaller;
      font-family: Verdana, Sans-Serif;
      width:100%
}

.Address
{
      font-weight: bolder;
      font-size: smaller;
      width: 100%;
      color: white;
      font-family: Verdana, Sans-Serif;
      background-color: #8db6cc;
      text-align: center;
}

.goToMap
{
      width: 100%;
      cursor: hand;
      font-family: wingdings;
      text-align: center;
      
}

.ExpExcel
{
      font-weight: bold;
      font-size: x-small;
      width: 100%;
      cursor: hand;
      color: #0033cc;
      font-family: Verdana, Sans-Serif;
      text-align: center;
      text-decoration: underline;
}

.repTable TH
{
      font-weight: bold;
      font-size: smaller;
      color: #ffff66;
      font-family: Verdana, Sans-Serif;
      background-color: #00659c;
      text-align: left;
}
            
            </style>
      </HEAD>

      <body >
            </body>
</HTML>


0
 

Author Comment

by:mmalaka
ID: 18002034
the server code to build the table is as follows

            private void Page_Load(object sender, System.EventArgs e)
            {
                  Response.Write(Session["ExcelContents"].ToString().Replace("\"", "'"));
                  Response.End();
            }
Session["ExcelContents"] hold the follwoing value:

"<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" class=\"repTable\"><tr>\t<td class=\"Address\" colspan=\"3\">ded</td></tr><tr>\t<th>Map</th>\t<th>ID1</th></tr><tr>\t<td><span class=\"goToMap\" onclick=GoToInMap(\"6a0198225419492da7e27ed042df1847\",\"101\");>&#245;</span></td>\t<td>101</td>\t<td><input type=\"button\" value=\"more\" onclick=GetDetails(\"6a0198225419492da7e27ed042df1847\",\"101\"); /></td></tr></table><span style=\"width:100%;text-align:center;\"><< results 1 to 1 of 1 >></span>"
0
 
LVL 6

Expert Comment

by:bigphuckinglizard
ID: 18002042
what does the code for the entire generated xls file look like?
0
 

Author Comment

by:mmalaka
ID: 18002063
ok,,,

when I remove the content-type of application/vnd.ms-excel and regenrate the page again I got this when I view the source

<table cellpadding='0' cellspacing='0' border='1' class='repTable'><tr>      <td class='Address' colspan='3'>ded</td></tr><tr>      <th>Map</th>      <th>ID1</th></tr><tr>      <td><span class='goToMap' onclick=GoToInMap('6a0198225419492da7e27ed042df1847','101');>&#245;</span></td>      <td>101</td>      <td><input type='button' value='more' onclick=GetDetails('6a0198225419492da7e27ed042df1847','101'); /></td></tr></table><span style='width:100%;text-align:center;'><< results 1 to 1 of 1 >></span>





0
 

Author Comment

by:mmalaka
ID: 18002078
Ok

Just now I solve it

I added a PlaceHolder Control in the page so the HTML Page is now look like this

<%@ Page language="c#" Codebehind="Excel_Report.aspx.cs" AutoEventWireup="false" Inherits="Lgcsb.Gis.CB.Excel_Report"  contentType="application/vnd.ms-excel"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
      <HEAD>
            <TITLE>QueryForm</TITLE>
            <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
            <meta name="CODE_LANGUAGE" Content="C#">
            <meta name="vs_defaultClientScript" content="JavaScript">
            <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
            <style>


.QueryForm { BORDER-RIGHT: black thin solid; TABLE-LAYOUT: auto; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid; BORDER-COLLAPSE: collapse }


.header { BORDER-RIGHT: black thin; BORDER-TOP: black thin; FONT-SIZE: smaller; BORDER-LEFT: black thin; COLOR: white; BORDER-BOTTOM: black thin; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #00659c; TEXT-ALIGN: left }


.Address { FONT-SIZE: smaller; WIDTH: 100%; COLOR: white; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #8db6cc; TEXT-ALIGN: left }


.Address { FONT-WEIGHT: bolder; FONT-SIZE: smaller; WIDTH: 100%; COLOR: white; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #8db6cc; TEXT-ALIGN: center }


.goToMap { WIDTH: 100%; CURSOR: hand; FONT-FAMILY: wingdings; TEXT-ALIGN: center }


.ExpExcel { FONT-WEIGHT: bold; FONT-SIZE: x-small; WIDTH: 100%; CURSOR: hand; COLOR: #0033cc; FONT-FAMILY: Verdana, Sans-Serif; TEXT-ALIGN: center; TEXT-DECORATION: underline }


.repTable TH { FONT-WEIGHT: bold; FONT-SIZE: smaller; COLOR: #ffff66; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #00659c; TEXT-ALIGN: left }


            </style>
      </HEAD>
      <body>
            <asp:placeholder id="phQueries" Runat="server"></asp:placeholder>
      </body>
</HTML>


and I use the following C# to upload the content of the report

phQueries.Controls.Add(new LiteralControl(Session["ExcelContents"].ToString().Replace("\"", "'")));
0
 
LVL 6

Expert Comment

by:bigphuckinglizard
ID: 18002098
why not just have a literal in the page and set the text property in the codebehind?
0
 

Author Comment

by:mmalaka
ID: 18186208
This is the Solution

<%@ Page language="c#" Codebehind="Excel_Report.aspx.cs" AutoEventWireup="false" Inherits="Lgcsb.Gis.CB.Excel_Report"  contentType="application/vnd.ms-excel"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
     <HEAD>
          <TITLE>QueryForm</TITLE>
          <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
          <meta name="CODE_LANGUAGE" Content="C#">
          <meta name="vs_defaultClientScript" content="JavaScript">
          <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
          <style>


.QueryForm { BORDER-RIGHT: black thin solid; TABLE-LAYOUT: auto; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid; BORDER-COLLAPSE: collapse }


.header { BORDER-RIGHT: black thin; BORDER-TOP: black thin; FONT-SIZE: smaller; BORDER-LEFT: black thin; COLOR: white; BORDER-BOTTOM: black thin; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #00659c; TEXT-ALIGN: left }


.Address { FONT-SIZE: smaller; WIDTH: 100%; COLOR: white; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #8db6cc; TEXT-ALIGN: left }


.Address { FONT-WEIGHT: bolder; FONT-SIZE: smaller; WIDTH: 100%; COLOR: white; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #8db6cc; TEXT-ALIGN: center }


.goToMap { WIDTH: 100%; CURSOR: hand; FONT-FAMILY: wingdings; TEXT-ALIGN: center }


.ExpExcel { FONT-WEIGHT: bold; FONT-SIZE: x-small; WIDTH: 100%; CURSOR: hand; COLOR: #0033cc; FONT-FAMILY: Verdana, Sans-Serif; TEXT-ALIGN: center; TEXT-DECORATION: underline }


.repTable TH { FONT-WEIGHT: bold; FONT-SIZE: smaller; COLOR: #ffff66; FONT-FAMILY: Verdana, Sans-Serif; BACKGROUND-COLOR: #00659c; TEXT-ALIGN: left }


          </style>
     </HEAD>
     <body>
          <asp:placeholder id="phQueries" Runat="server"></asp:placeholder>
     </body>
</HTML>

0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18200098
PAQed with points refunded (20)

Computer101
EE Admin
0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

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

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

650 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