Saturday, July 6, 2013

Google Drive Document Capitalization of Text

Question:

Is there a quick way to capitalize the entire text of a Google Document?


Solution:

Yes, you can capitalize the entire text of a Google Document.

Let us have an example. Following is the screenshot of my Google Document:





Now, just copy and paste the following script in the script editor of your Google Document:


function Capitalization() {
  var body = DocumentApp.getActiveDocument().getBody();
  var mytext = body.getText().toString().toUpperCase();
  body.setText(mytext);
};


And after that, you have to run the function Capitalization() in your script editor.

Now, you will get the following results:




The above script will convert all the text to capital letters. And if you have images or any such multimedia then I would suggest you to make a copy of your Google Document and then first try this script on this copy.

When you have images in your Document then script will only take all of your text and capitalize it and put all your pictures below the text.

So use the above script only if your Document contains Text only.
You can also work out on the script if you have knowledge of scripting and make it generalize for any kind of Document.


And If you are not much familiar with scripts then check out the following link:
http://igoogledrive.blogspot.com/2012/08/how-to-write-script-in-google.html 

I hope the above solution will help you, and if you need more help then please do comment below on this blog itself, I will try to help you out.


I also take up private and confidential projects:
If this blog post was helpful to you, and if you think you want to help me too and make my this blog survive then please donate here: http://igoogledrive.blogspot.com/2012/09/donate.html 

Thanks,

1 comment:

  1. I just want drive to automatically capitalize I's, it gets annoying having to hold shift or press caps on then type I, then turn it off again. It gets a little redundant.

    ReplyDelete