Reputation: 65
I'm generating a document from gCal data and I cannot figure out what's causing the extra padding under the text.
In the pic, you'll see I've selected some text for the screenshot and the height of the selection is almost double the size of the height of the text.
var entriesTableStyle = {};
entriesTableStyle[DocumentApp.Attribute.PADDING_BOTTOM] = 0;
entriesTableStyle[DocumentApp.Attribute.PADDING_TOP] = 0;
entriesTableStyle[DocumentApp.Attribute.PADDING_RIGHT] = 0;
entriesTableStyle[DocumentApp.Attribute.PADDING_LEFT] = 0;
entriesTableStyle[DocumentApp.Attribute.BORDER_WIDTH] = 1;
// Date
var entryDateStyle = {};
entryDateStyle[DocumentApp.Attribute.BOLD] = true;
entryDateStyle[DocumentApp.Attribute.FONT_SIZE] = 14;
entryDateStyle[DocumentApp.Attribute.PADDING_BOTTOM] = 0;
entryDateStyle[DocumentApp.Attribute.WIDTH] = 140;
entryDateStyle[DocumentApp.Attribute.PADDING_BOTTOM] = 0;
entryDateStyle[DocumentApp.Attribute.PADDING_TOP] = 0;
entryDateStyle[DocumentApp.Attribute.PADDING_RIGHT] = 0;
entryDateStyle[DocumentApp.Attribute.PADDING_LEFT] = 0;
entryDateStyle[DocumentApp.Attribute.MINIMUM_HEIGHT] = 25;
// Title
var entryTitleStyle = {};
entryTitleStyle[DocumentApp.Attribute.FONT_SIZE] = 12;
entryTitleStyle[DocumentApp.Attribute.MINIMUM_HEIGHT] = 0;
entryTitleStyle[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] = DocumentApp.HorizontalAlignment.RIGHT;
entryTitleStyle[DocumentApp.Attribute.LINE_SPACING] = 3;
entryTitleStyle[DocumentApp.Attribute.MINIMUM_HEIGHT] = 13;
entryTitleStyle[DocumentApp.Attribute.FONT_FAMILY] = DocumentApp.FontFamily.UBUNTU;
// entryTimes
var entryTimesStyle = {};
entryTimesStyle[DocumentApp.Attribute.BOLD] = true;
entryTimesStyle[DocumentApp.Attribute.FONT_SIZE] = 10;
entryTitleStyle[DocumentApp.Attribute.MINIMUM_HEIGHT] = 12;
// entryDescription
var entryDescriptionStyle = {};
entryDescriptionStyle[DocumentApp.Attribute.ITALIC] = true;
entryDescriptionStyle[DocumentApp.Attribute.FONT_SIZE] = 10;
entryDescriptionStyle[DocumentApp.Attribute.INDENT_FIRST_LINE] = 40;
entryDescriptionStyle[DocumentApp.Attribute.INDENT_START] = 40;
entryDescriptionStyle[DocumentApp.Attribute.MINIMUM_HEIGHT] = 10;
Upvotes: 1
Views: 674
Reputation: 65
So it appears I was trying to set the style on a TABLE_CELL where I should have been setting the style of the PARAGRAPH.
var entryTitle = events[i].getTitle();
var entryTimes = shortTime(events[i].getStartTime(),2) + " - " + shortTime(events[i].getEndTime(),2);
var entryHoursWorked = ((events[i].getEndTime() - events[i].getStartTime())/(1000*60*60)%24);
var row2 = entriesTable.appendTableRow();
row2.appendTableCell(entryTitle).setWidth(140);
var row2Cell1Paragraph = row2.getChild(0).getChild(0);
row2Cell1Paragraph.setAttributes(entryTimesStyle);
row2.appendTableCell(entryTimes + "\t\t" + entryHoursWorked + "hr(s)")
var row2Cell2Paragraph = row2.getChild(1).getChild(0);
row2Cell2Paragraph.setAttributes(entryTimesStyle);
A TABLE_CELL doesn't have the same attributes as a PARAGRAPH which is why nothing was ever set properly.
Upvotes: 2