zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    Linux ->> VirtualBox Linux虚拟机与Windows主机共享目录
    Linux ->> CentOS 7 执行service network restart 报错
    借助企业微信实现“调接口”给个人微信发消息
    idea提交代码到github教程
    Content type ‘multipart/form-data;boundary=--------------------------9107
    org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'multipart/form-data;bounda
    org.hibernate.LazyInitializationException: could not initialize proxy 解决方案(JPA)
    GitLab代码回滚到特定版本
    js 导入excel文件
    GoLand 2021.1.3安装之后需要激活得步骤
  • 原文地址:https://www.cnblogs.com/janmson/p/1516084.html
Copyright © 2011-2022 走看看