alternate CSS stylesheet for IQY queries? (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets and Accessibility



Message


mtfm -> alternate CSS stylesheet for IQY queries? (7/12/2006 11:50:56)

I have a big list of tabular data on my site, which some users occasionally print-- or at least they would if I could get it to print without knocking off the left two columns. I did an alternate stylesheet for printing and everything, with the alt stylesheet knocking off everything but the content-- still no go. This is on a company intraweb, so 99% of the people ever looking at this are in IE 6.0 for windows, SP2.

What I'm thinking of doing now is to have the option of an IQY file, which will pull things into Excel. If I can specify an alternate stylesheet for Excel, then I can make it print the way I want it, since Excel has a little more flexibility.

But I don't know if it is possible. I assume it is, since you can do an alternate stylesheet for any specific browser, as well as for printing. I just don't know how to do it.


This is the javascript code I am using now for a stylesheet switcher for printing purposes.


Anyone who can help, I would be greatly appreciative!



<script language="javascript"> // This script allows the definition of a seperate stylesheet for printing.//

function styleSheetPicker()
{
   this.ieScreen = this.iePrint = this.otherScreen = this.otherPrint = "";
}

styleSheetPicker.prototype.render = function()
{
   if (document.createStyleSheet)
   {
    if (this.ieScreen)
     document.createStyleSheet(this.ieScreen);

    if (this.iePrint)
        {
     var ieP = document.createStyleSheet(this.iePrint);
            ieP.media = "print";
        }
   }
   else
   {
        var head = document.getElementsByTagName("head")[0];
    if (this.otherScreen != "")
            head.innerHTML += "<link rel=\"stylesheet\" href=\"" + this.otherScreen + "\">";

    if (this.otherPrint != "")
            head.innerHTML += "<link rel=\"stylesheet\" media=\"print\" href=\"" + this.otherPrint + "\">";

   }
}

var picker = new styleSheetPicker();

// IE stylesheets
picker.ieScreen = "../intraweb/js_files_and_site_pieces/stylesheet1.css";
picker.iePrint= "../intraweb/js_files_and_site_pieces/stylesheet_for_printing.css";

picker.otherScreen = "../intraweb/js_files_and_site_pieces/stylesheet1.css";
picker.otherPrint = "../intraweb/js_files_and_site_pieces/stylesheet_for_printing.css";

picker.render();

</script>




jaybee -> RE: alternate CSS stylesheet for IQY queries? (7/15/2006 6:59:56)

You don't need to go to all that trouble, you can just use a print style sheet as well as a media style sheet.

Here's a really good article on it by one of the gurus.

Have fun.




mtfm -> RE: alternate CSS stylesheet for IQY queries? (7/19/2006 18:32:27)

Well, whaddya know.. it works. [:)] I swear I read somewhere that IE didn't support alternate stylesheets. I wouldn't have gone with all that ugly Javascript had I known this to begin with.


Thanks! You're a big help as always.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875