Home / eaDocX Homepage / EaDocX Help / eaDocX Script examples / Seamless formatting
Seamless formatting
function CustomTable() { // Parameters passed to the script: // ElementGuids - guids of some elements. May be only one. // Repository // Tell eaDocX that this is an eaDocX Script //<Type>eaDocX</Type> // Get the list of GUIDs from the parameter passed by eaDocX var elemGuids = ElementGuids.toString(); // Split them up into individual GUIDs for processing var guids = elemGuids.split(","); //This code tried to add some more complex formatting into the output // to make the table look like other eaDocX tables. // Create a string to hold the HTML var outputHTML = ""; // Start the table outputHTML += "<table border='2' style='border-collapse: collapse' cellpadding='3' width='400' '>\r\n"; // Add the table header outputHTML += "<thead>" outputHTML += "<tr bgcolor='#EEEEEE'> " outputHTML += "<td width='100' valign='middle' > <p class='xTableHead' >Name</p></td> " outputHTML += "<td width='200' valign='middle' > <p class='xTableHead' >Notes</p></td> " outputHTML += "<td width='100' valign='middle' > <p class='xTableHead' >Author</p></td> " outputHTML += "</tr>"; outputHTML += "</thead>"; // Loop through each GUID for (var i = 0; i < guids.length; i++) { // Get the EA.Element by GUID var theElement = Repository.GetElementByGuid(guids); if (theElement !== null) { // Add a row for the element outputHTML += "<tr class='xTableBody'>"; outputHTML += "<td valign='middle'><p class='xTableBody'>" + theElement.Name + "</p></td>"; outputHTML += "<td valign='middle'><p class='xTableBody'>" + theElement.Notes + "</p></td>"; outputHTML += "<td valign='middle'><p class='xTableBody'>"+ theElement.Author + "</p></td>"; outputHTML += "</tr>\r\n"; } else { // Element not found; skip or log if needed } } // Complete the HTML outputHTML += "</table>\r\n"; return outputHTML; } // Call the function result = CustomTable();