2017-09-14 139 views
0

我有一個問題,其中有時(不確切時),顯示一個嵌入文檔docs.google.com不顯示文檔,直到我調整瀏覽器窗口的大小。谷歌文檔嵌入式文檔直到調整大小才顯示?

抓住一些爆米花,這裏有一個電影,顯示了問題:

enter image description here

這裏是我的代碼:

HTML:

<iframe runat="server" id="frame" style="width:100%;height:600px;border:0;"></iframe> 

C#代碼begind(在Page_Load法) :

frame.Attributes["src"] = "https://docs.google.com/gview?url=https://example.com/1.doc&embedded=true"; 

我試圖通過直接瀏覽到https://docs.google.com/gview?url=https://example.com/1.doc&embedded=true來重現它,但它從來沒有發生過這種方式。

注意:有時文檔從來沒有displayd,就好像它從未加載,並且iFrame保持空白。

任何想法如何解決這個問題?

+0

您是否嘗試在像素中設置寬度?例如500px – Saeed

+0

@Saeed沒有幫助 - 修正'寬度'相同的問題。 –

回答

0

您可以嘗試設置默認文檔大小。這是我從Google Docs打印信封的方法

var envelope10={}; 
    envelope10[DocumentApp.Attribute.PAGE_HEIGHT]=296; 
    envelope10[DocumentApp.Attribute.PAGE_WIDTH]=684; 
    envelope10[DocumentApp.Attribute.FONT_FAMILY] = 'Calibri'; 
    envelope10[DocumentApp.Attribute.FONT_SIZE] = 18; 
    envelope10[DocumentApp.Attribute.BOLD] = true; 
    envelope10[DocumentApp.Attribute.LINE_SPACING]=1;