Problem with external css stylesheet for printing - InfoPath Dev
in

InfoPath Dev

Problem with external css stylesheet for printing

Last post 06-12-2006 04:53 AM by glebur. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 05-31-2006 08:10 AM

    Problem with external css stylesheet for printing

    Hi,

    I noticed that when you try to print an Infopath form, half the page is usually out of the print area so there's no way you can have the form in its full width on a single sheet.

    To avoid that, I wrote a CSS stylesheet that I tried to include in view1.xsl :


    (view1.xsl)
    <head>
    ...
    <style themeStyle="urn:office.microsoft.com:themeBlue">BODY {
    COLOR: black; BACKGROUND-COLOR: white
    }
    TABLE {
    BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse
    }
    ...
    </style>
    <link rel="stylesheet" type"text/css" href="print.css"/>
    </head>


    print.css is in the same directory as view1.xsl.
    The problem is, when I try to open the Infopath form in design mode, I get an error : "Infopath failed to open this form : ...\...\myform.xsf.
    A name contained an invalid character".

    Whatever I place in that CSS stylesheet (even nothing) I get the error, but when I remove the link to the external stylesheet the error disappears.

    Does anyone know how to solve that ?
    Any help appreciated.
  • 05-31-2006 09:54 AM In reply to

    Re: Problem with external css stylesheet for printing

    To print the InfoPath form correctly, limit the size of the section to be around 6.5 inches. This will print the width in a single page. What is the size of your table or the section in which your controls are present? You can reduce that width to get everything to be printed in a single page.
    Shanthi Reddy
  • 06-02-2006 04:52 AM In reply to

    Re: Problem with external css stylesheet for printing

    The size is 731 px because many users are still in 800x600.
    But I'd like to set a different size for display and for printing, which I can't do because of that error...
  • 06-08-2006 08:06 AM In reply to

    Re: Problem with external css stylesheet for printing

    Anyone ?
  • 06-08-2006 08:45 AM In reply to

    Re: Problem with external css stylesheet for printing

    Hi Glebur,

    Sorry for the late response. Please check out this HowTo:http://www.infopathdev.com/howto/tutorials/default.aspx?i=a396459320204261ad2379381824683d

    I think the crucial step you're missing is adding the file as a resource.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-09-2006 01:06 AM In reply to

    Re: Problem with external css stylesheet for printing

    Hi Matt,

    I followed exactly that howto (including adding the file as a resource), that's precisely what puzzles me.

    I've just gone through the whole process over again but the error message is still there.

    Could it be the css file's encoding or something ? I created it with Visual Studio 2003...

    quote:
    Originally posted by Matt Faus

    Hi Glebur,

    Sorry for the late response. Please check out this HowTo:http://www.infopathdev.com/howto/tutorials/default.aspx?i=a396459320204261ad2379381824683d

    I think the crucial step you're missing is adding the file as a resource.

  • 06-09-2006 02:18 AM In reply to

    Re: Problem with external css stylesheet for printing

    Hm, Ok. Sorry to insult your intelligence :)

    It seems like your CSS file is not in correct syntax. Could you paste it here so we can take a look? It's interesting that you created it with VS2003, and it's using an invalid character in one of the names. Maybe you are using a reserved keyword that's only reserved in InfoPath's context?
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-09-2006 05:55 AM In reply to

    Re: Problem with external css stylesheet for printing

    Well you won't believe me but I deleted print.css, re-created it and it works now (whatever text it contains) !

    Something must have been wrong with the file encoding or I don't know what...

    Anyway, thanks for putting in your intelligence to help ;)
  • 06-12-2006 01:43 AM In reply to

    Re: Problem with external css stylesheet for printing

    Well I'm facing a new problem. Here's the contents of the stylesheet :

    table {  FONT-FAMILY: Wingdings !important; }
    span { FONT-FAMILY: Wingdings !important; }
    col { FONT-FAMILY: Wingdings !important; }


    When the reference to this external stylesheet is <link rel="stylesheet" type="text/css" href="print.css"/>, everything works fine (you can tell it straight away because of the weird Wingdings characters that appear).

    However when I try to limit the stylesheet to printing ( <link rel="stylesheet" type="text/css" media="print" href="print.css"/> ), the styles don't apply !

    Is this because the internal styles have priority over external ones when you print ?
  • 06-12-2006 04:53 AM In reply to

    Re: Problem with external css stylesheet for printing

    I solved that by creating an internal @media print style.
    This is not very convenient though since I have to rewrite the style in each view's xsl file...
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.