Home / eaDocX Homepage / EaDocX Help / eaDocX Script examples / Simple table
Simple table
function Blocks() { // 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> //Script to do printing of a simple table. // 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(","); // Create a string to hold the HTML var outputHTML = ""; // Start the table outputHTML += "<table border='2' style='border-collapse: collapse'>\r\n"; // Add the table header outputHTML += "<tr><strong><td width=200>Name</td><td width=200>Notes</td><td width=100>Author</td></strong></tr>"; // 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>"; outputHTML += "<td>" + theElement.Name + "</td>"; outputHTML += "<td>" + theElement.Notes + "</td>"; outputHTML += "<td>" + theElement.Author + "</td>"; outputHTML += "</tr>"; } else { // Element not found; skip or log if needed } } // Complete the HTML outputHTML += "</table>\r\n"; return outputHTML; } // Call the function result = Blocks();