Thanks David for the point.
Still not working. Maybe that you and I are not very familiar with such expressions, but it is difficult to understand that this is so complex that nobody can helps…
I decided to try 3 differents simple ways, based on instructions on this chat:
1-Very simple Embedded Excel spreadsheet [doesn’t works]
2-HTML page using the same process as 1 [works]
3-Same HTML page but based on @janettabloomquist notes (b) [doesn’t works]
1 and 2 have the same mecanism to print, but it doesn’t work with the Microsoft 365 embedded spreadsheet.
My conclusion is that we cannot print an Iframe that contains Microsoft embedded spreadsheet.
We can see the result by copying the URL in the first line below:
1-
<iframe id="biq" width="402" height="346" frameborder="0" scrolling="no" src="https://bitumequebecorg.sharepoint.com/sites/BiQ2/_layouts/15/Doc.aspx?sourcedoc={452dbd74-22e5-40c8-8808-81ec80fa6b5a}&action=embedview&wdAllowInteractivity=False&wdHideGridlines=True&wdHideHeaders=True&wdDownloadButton=True&wdInConfigurator=True&wdInConfigurator=True&edesNext=false&resen=true&ed1JS=false"></iframe>
<button onclick="printBiQ()">Print iframeBiQ</button>
<script> function printBiQ() {
var iframe = document.getElementById('biq');
var iframeWindow = iframe.contentWindow;
iframeWindow.focus();
iframeWindow.print();
}
</script>
2-
<iframe id="myIframe" src="https://guignoleerivesud.org/atestforiframe/"></iframe>
<button onclick="printIframe()">Print iframex1</button>
<button onclick="printIframe2()">Print iframex2</button>
a-
<script> function printIframe() {
var iframe = document.getElementById('myIframe');
var iframeWindow = iframe.contentWindow;
iframeWindow.focus();
iframeWindow.print();
}
</script>
b-
<script>
function printIframe2() {
var iframe = document.getElementById('myIframe');
var iframeWindow = iframe.contentWindow;
var printWindow = window.open('', '_blank', 'height=600,width=800');
printWindow.document.write(iframeWindow.document.documentElement.outerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}</script>
Gaston, you may be on to something—that there is a unique problem with printing an embedded MS Office 365 Excel spreadsheet. I may try a cloud-based Google Sheets spreadsheet to see if that would work. I much prefer Excel, but I could use a Google Sheets doc if it would print.
This is still an unresolved issue for me. I did reach out to Microsoft to see if they could help, but they insisted that the problem (or the observed behavior of the embedded spreadsheet not printing) resides within the Wix platform.
Finally, I understand that we face a cross-origin issue. This prevents a script in one domain to manipulate data from another domain, and to print, you have to process data… Even what I thought was just a screen shot made from a JS script is not like “taking a picture” is not. It is very secure, but limit what we can do with the iFrame content when the content comes from another domain. If you find a solution, please share it here. In my case I will convert my spreadsheet to a Java script + HTML file and use it “locally”.
Can I simply say what a reduction to seek out somebody who actually is aware of what theyre talking about on the internet. You undoubtedly know the best way to bring an issue to gentle and make it important. Extra individuals have to read this and understand this facet of the story. I cant believe youre not more popular because you positively have the gift.
www.myfordbenefits. me/
JavaScript’s “window.print()” method can be used to print the contents of a “iframe>” element. However, keep in mind that you can only print the contents of the “iframe” if the parent page and the “iframe”'s contents are both from the same domain and follow the same-origin policy.
Here is an illustration of how to print a ‘iframe>’ element’s contents:
“''html”; “!DOCTYPE html”; “html”; “head”; "title"Print the contents of the iframe (script)
the following code is in the function printIframeContents(): var iframe = document.getElementById(“myIframe”); iframe.contentWindow.print();
the button onclick=“printIframeContents()” in the body, the script, and the header.Print Iframe/button> iframe src=“example.html” id=“myIframe”>/iframe> /body> /html>
The 'printIframeContents()' method is called in this example when the button is pressed. It then utilises the 'contentWindow' property to access the window object of the 'iframe>' after retrieving the 'iframe>' element using its ID,'myIframe'. The print dialogue for the contents of the "iframe>" is then opened by using the "print()" function on the "contentWindow."
https://www.dqfanfeedback.one/
The actual URL or file location of the material you want to publish inside the "iframe>" should be substituted for "example.html." To make this work, keep in mind that the 'iframe''s content must originate from the same domain as the parent page.
The user can choose a printer and print the contents of the "iframe>" once the print dialogue has appeared.