13

I found this question, which seems to suggest I can just paste in my HTML, but when I try that it just looks like HTML, it does not render. Below is what I am pasting in:

<pre style="background:rgba(238,238,238,0.92);color:#000">&lt;?php
$stmt <span style="color:#00f">=</span> $dbConnection<span style="color:#00f">-></span>prepare(<span style="color:#093">'<span style="color:#00f">SELECT</span> <span style="color:#00f">*</span> <span style="color:#00f">FROM</span> employees <span style="color:#00f">WHERE</span> name <span style="color:#00f">=</span> ?'</span>);
$stmt<span style="color:#00f">-></span>bind_param(<span style="color:#093">'s'</span>, $name);

$stmt<span style="color:#00f">-></span>execute();

$result <span style="color:#00f">=</span> $stmt<span style="color:#00f">-></span>get_result();
<span style="color:#00f">while</span> ($row <span style="color:#00f">=</span> $result<span style="color:#00f">-></span>fetch_assoc()) {
    <span style="color:#06f;font-style:italic">// do something with $row</span>
}
?>
</pre>

Does anyone know what I need to do to get it to actually render?

2
  • 1
    Are you actually trying to embed some PHP code with highlighting? Commented Oct 4, 2013 at 12:30
  • Yes exactly. Just to clarify, I don't expect it to execute or anything. I just want to have PHP code on the page with colored text. Commented Oct 4, 2013 at 15:07

5 Answers 5

3

Google docs won't actually render HTML, or execute any code pasted into it. What you can do is view your HTML as a page in the browser, which will show:

php code

Copy it from the web page, then paste into your document - it will look like this:

PHP pasted to Google docs

The question you referred to was for people who wanted to present their HTML code within the document with syntax highlighting, not have it rendered.

1
2

I always do this and it works for me.

  1. Save the HTML file as it is, just save it as HTML.
  2. Open the saved file (HTML) with Word.
  3. Save it as Word format i.e DOC or DOCX.
  4. Upload the saved word file into Google Docs.

That's it.

1

This is the closest I have been able to get:

  1. Upload your HTML file to google drive
  2. Open the file by double-clicking and select "open with google docs"

enter image description here

This way docs will try as much as it can to render the data.

what I got: enter image description here enter image description here

0
0

Open the page in the browser so it renders normally. Then press ctrl+A and ctrl+C in the browser. Now go to Google Docs and press ctrl+V.

Google Docs will try to render the html as it is seen in the browser, but is not perfect. You will need to make manual adjustments to get it exactly right.

-2

Add Editey apps to your Google Drive. (Editey, CSS Editey, HTML Editey and JsEditey).

"editEy apps on google drine

2
  • Why don't you show us an example of prettified HTML code in a Google Document?
    – Jacob Jan
    Commented Jan 4, 2014 at 18:41
  • 1
    Are you affiliated with this product? If so, you need to disclose that in your post. Please see the help center.
    – ale
    Commented Jan 4, 2014 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.