Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Where in this code should I add custom sizes for the application?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 643
    Answer it

    I have created a script within Google Scripts Editor so that when a user clicks on a menu on the toolbar in Google Sheets it brings up an application box where users click to print.

    However, i'm not sure how I could add custom sizes for that application box that appears without messing up the code.

    function onOpen() {
      SpreadsheetApp.getUi()
          .createMenu('Click to print')
          .addItem('Print from Google Cloud', 'openDialog')
          .addToUi();
    }
    
    function openDialog() {
    var html = HtmlService.createHtmlOutputFromFile('Index')
        .setSandboxMode(HtmlService.SandboxMode.NATIVE);
        SpreadsheetApp.getUi()
        .showModalDialog(html, 'Click the button below to print using the Google Cloud Print service.');
    }

    and the index.html code is:

    <!DOCTYPE html>
    <html>
      <head>
        <base target="_top">
        <script src="https://www.google.com/cloudprint/client/cpgadget.js">
    </script>
    <script>
      window.onload = function() {
        var gadget = new cloudprint.Gadget();
        gadget.setPrintButton(
            cloudprint.Gadget.createDefaultPrintButton("button"));
                var liabilityWaiver = waiver.getAs(MimeType.PDF);
        gadget.setPrintDocument("url", "Test Page", "https://drive.google.com/open?id=0B3NraNAa2RhWSldiNklPVGI5OU0");
      }
    </script>
      </head>
      <body>
        <div id="button"></div>
      </body>
    </html>

    Below are image explanations of what the script does:

     

    As you can see from the last image, that is where the problem is, the application box is too small to fit all of the information on it, therefore cutting it out.

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: