processSectionDetails method
Function for processing section details
Implementation
void processSectionDetails(xml.XmlElement sectionElement, Document wordDocument) {
var chckPgSz = sectionElement.findAllElements("w:pgSz");
if (chckPgSz.isNotEmpty) {
double tmpWidth = 0;
double tmpHeight = 0;
var pgWidth = chckPgSz.first.getAttribute("w:w");
if (pgWidth != null) {
tmpWidth = (int.parse(pgWidth) / 1440) * 38;
}
var pgHeight = chckPgSz.first.getAttribute("w:h");
if (pgHeight != null) {
tmpHeight = (int.parse(pgHeight) / 1440) * 38;
}
wordDocument.pageSize = Size(tmpWidth, tmpHeight);
}
var chckPgMar = sectionElement.findAllElements("w:pgMar");
if (chckPgMar.isNotEmpty) {
Map<String, double> tempMar = {};
var tMar = chckPgMar.first.getAttribute("w:top");
if (tMar != null) {
tempMar["topMar"] = (int.parse(tMar) / 1440) * 38;
}
var bMar = chckPgMar.first.getAttribute("w:bottom");
if (bMar != null) {
tempMar["bottomMar"] = (int.parse(bMar) / 1440) * 38;
}
var rMar = chckPgMar.first.getAttribute("w:right");
if (rMar != null) {
tempMar["rightMar"] = (int.parse(rMar) / 1440) * 38;
}
var lMar = chckPgMar.first.getAttribute("w:left");
if (lMar != null) {
tempMar["leftMar"] = (int.parse(lMar) / 1440) * 38;
}
var hMar = chckPgMar.first.getAttribute("w:header");
if (hMar != null) {
tempMar["headerMar"] = (int.parse(hMar) / 1440) * 38;
}
var fMar = chckPgMar.first.getAttribute("w:footer");
if (fMar != null) {
tempMar["footerMar"] = (int.parse(fMar) / 1440) * 38;
}
var gMar = chckPgMar.first.getAttribute("w:gutter");
if (gMar != null) {
tempMar["w:gutter"] = (int.parse(gMar) / 1440) * 38;
}
wordDocument.pageMargin = tempMar;
}
}