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.

  • 相关阅读:
    首次调用u8api遇到的问题总结
    为datagridview添加自定义按钮
    我对数据库索引的初步了解
    ObjectARX 常见编译错误解决方式记录
    手动修改Visual Studio 版本互转工具
    [经验] FAS 20号指令的深入研究
    Object ARX 统一设置所有图层的RGB颜色
    ARX 选择集获得所有图形 遍历 实例 备忘
    ObjectARX2010 学习笔记002:读取已经存在的DWG文件中的内容
    利用编译时的全局声明对抗反编译
  • 原文地址:https://www.cnblogs.com/janmson/p/1516084.html
Copyright © 2011-2022 走看看