• print style Iframe


    IFrame Print Styles In CRM

    I've written a few IFrames to help extend CRM in the past, but recently, an issue with them was brought to my attention that no one had ever mentioned to me (and, therefore, I'd assume that no client had ever complained about, either).

    A client had tried to print a page that had an IFrame I developed on it.  Instead of whatever was in the IFrame, there was nothing.  I.e. my IFrame was hidden.  Immediately, I realized that IFrames must be hidden in CRM.  Whether on purpose or by accident (on Microsoft's part), I had to get this resolved.  All my hard work was being hidden by CRM!

    So I parsed through the myriad of pages and style sheets that CRM installs on the server, looking for how it interprets IFrames, and found this in one of the style sheets:

    IFRAME.custom
    {
        100%;
    height:    100%;
    border:    1px solid #7b9ebd;
    behavior:   url(/_forms/controls/IFRAME.htc);
    }

    All IFrames get the class "custom" by default.  So, all I had to do was go into the print style sheet and put something awfully similar: 

    IFRAME.custom
    {
        100%;
    height:    30px;
    border:    1px solid #7b9ebd;
    behavior:   url(/_forms/controls/IFRAME.htc);
    }

    I had to give it a height, because it seems to make the height 0% or 0px, though I don't know where that's defined.  Of course, you'll want to put new, print-oriented styles in your style sheet you use for the IFrame.  For this IFrame, I was creating what looked like a lookup for contacts, so I had these styles (yours may vary):

    input
    {
     font-family: Tahoma;
     font-size: 11px;
     border-color: White;
     border- 0px;
     color: Black;
    }

    DIV.lu
    {
     height:    0px;
    }

    TABLE.lu
    {
     height: 0px;
    }

    IMG.lu
    {
     height: 0px;
    }

    This will set the linked text (the contact's name) to black, the search button to being invisible and all the other stuff surrounding the search button to being invisible.  You don't want it to looked like a linked text box, you want it to look like plain, black text.

    It doesn't recognize "media='print'" in your style sheet reference, btw, so you'll have to do something like I did:

       <script type='text/javascript'>
        var parentLocation = '' + window.parent.location + ''
        if(parentLocation.indexOf('/print/') >= 0)
        {
        // CSSReference is your <link> tag to your style sheet
         var cssReference = document.getElementById('CSSReference');
         if(cssReference != null)
         {
          cssReference.href = "MyStyleSheetForPrinting.css";
         }
        }
       </script>

    So, from now on, when you make an IFrame in CRM, you should consider all of this or your IFrames will not print at all.

  • 相关阅读:
    数据降维和可视化
    聚类
    支持向量机的实现
    支持向量机核函数
    支持向量基
    倾斜类误差度量
    构建垃圾邮件分类器
    POJ 2955 Brackets (区间dp入门)
    POJ 3126 Prime Path (bfs+欧拉线性素数筛)
    POJ 1426 Find The Multiple (dfs??!!)
  • 原文地址:https://www.cnblogs.com/janmson/p/1516084.html
Copyright © 2020-2023  润新知