javascript - How to use CSS styles with Google Apps table (grid) -



javascript - How to use CSS styles with Google Apps table (grid) -

i'm beginner looking help styling table produced google apps script, it's table displays list of google contacts, , started code this site.

i've been trying style adding .setstyleattributes({}) app.creategrid, grid.setwidget , app.createlabel can't seem find way target <td> elements on browsers. current page looks ok in chrome can't border collapse in firefox...

what able to:

have borders collapsing on firefox (done thanks) style cell borders horizontal bluish lines , no verticals (or white verticals)

anyway, here code producing table, suggestions or help appreciated.

//create grid hold contacts data, styles set <table> inline styles var grid = app.creategrid(sorted_contacts.length+1,6) .setborderwidth(1) .setcellpadding(5) .setstyleattributes({bordercollapse: "collapse", border: "1px solid #d1e2ff", borderbottom: "1px solid #d1e2ff", bordertop: "1px solid #d1e2ff", borderleft: "1px solid #fff", borderright: "1px solid #fff"}); //create header row grid.setwidget(0, 0, app.createlabel('name').setstyleattributes({fontfamily: "verdana, sans-serif", fontweight: "bold", color: "#384c80"})) .setwidget(0, 1, app.createlabel('email').setstyleattributes({fontfamily: "verdana, sans-serif", fontweight: "bold", color: "#384c80"})) .setwidget(0, 2, app.createlabel('home').setstyleattributes({fontfamily: "verdana, sans-serif", fontweight: "bold", color: "#384c80"})) .setwidget(0, 3, app.createlabel('work').setstyleattributes({fontfamily: "verdana, sans-serif", fontweight: "bold", color: "#384c80"})) .setwidget(0, 4, app.createlabel('mobile').setstyleattributes({fontfamily: "verdana, sans-serif", fontweight: "bold", color: "#384c80"})) .setwidget(0, 5, app.createlabel('address').setstyleattributes({fontfamily: "verdana, sans-serif", fontweight: "bold", color: "#384c80"})) //write contacts in grid/table (var i=0; i<sorted_contacts.length; i++){ //display first name + surname or surname if(sorted_contacts[i][0]!='') grid.setwidget(i+1, 0, app.createlabel(sorted_contacts[i][0]+' '+sorted_contacts[i][1]).setstyleattributes({fontfamily: "verdana, sans-serif", color: "#2e2e2e"})); else grid.setwidget(i+1, 0, app.createlabel(sorted_contacts[i][1]).setstyleattributes({fontfamily: "verdana, sans-serif", color: "#2e2e2e"})); //display rest of fields grid.setwidget(i+1, 1, app.createlabel(sorted_contacts[i][2]).setstyleattributes({fontfamily: "verdana, sans-serif", color: "#2e2e2e"})); grid.setwidget(i+1, 2, app.createlabel(sorted_contacts[i][3]).setstyleattributes({fontfamily: "verdana, sans-serif", color: "#2e2e2e"})); grid.setwidget(i+1, 3, app.createlabel(sorted_contacts[i][4]).setstyleattributes({fontfamily: "verdana, sans-serif", color: "#2e2e2e"})); grid.setwidget(i+1, 4, app.createlabel(sorted_contacts[i][5]).setstyleattributes({fontfamily: "verdana, sans-serif", color: "#2e2e2e"})); grid.setwidget(i+1, 5, app.createlabel(sorted_contacts[i][6]).setstyleattributes({fontfamily: "verdana, sans-serif", color: "#2e2e2e"})); } //add grid/table panel panel.add(grid); //add panel application app.add(panel); homecoming app;

perhaps want grid.setrowstyleattributes(rownum, styles), or grid.setcolumnstyleattributes(colnum, styles) or special grid version of setstyleattributes targets individual <td> - grid.setstyleattributes(rownum, colnum, styles)

javascript google-apps-script

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -