How to style a Google Doc using Google Drive API?

2020-08-04 10:01发布

问题:

Currently, I have a web application that basically consists in a simple form. When I submit this form, I generate a document that I send to Google Drive. It works.

My problem is that I have no styling and I wonder how I can do that? I tried with HTML and CSS but if the HTML allows me to structure my document, the CSS does nothing.

So, how could I do that?

回答1:

I guess you're uploading an HTML file, with convert=true, to create a Google Doc. Any "attached" CSS file will be ignored. There is some embedded element styling that will be honoured by the conversion process. Perhaps the best approach would be to create a sample styled document manually, then export it as HTML to see how the styling works.