Tag Archives: groovy

How to script Excel files with Groovy

Questions: I want to create excel files in Groovy, then have them plotted. This code was taken from an example using Microsoft’s Shell Scripting language: Set objExcel = CreateObject(“Excel.Application”) objExcel.Visible = True Set objWorkbook = objExcel.Workbooks.Add() Set objWorksheet = objWorkbook.Worksheets(1) objWorksheet.Cells(1,1) = “Operating System” objWorksheet.Cells(2,1) = “Windows Server 2003” objWorksheet.Cells(3,1) = “Windows XP” objWorksheet.Cells(5,1) =… Read More »

Comparing two XML strings/files in Groovy/Java

Questions: I’m writing unit tests for checking some XML builder. Now I’m running into the problem of syntactical differences between the expected result and the actual result, despite their identical semantics. Example: Expected result: <parent><child attr=”test attribute”>text here</child></parent> Actual result: <parent> <child attr=”test attribute”> text here </child> </parent> I tried normalizing the xml using XmlUtil.serialize(),… Read More »

Comparing two XML strings/files in Groovy/Java

Questions: I’m writing unit tests for checking some XML builder. Now I’m running into the problem of syntactical differences between the expected result and the actual result, despite their identical semantics. Example: Expected result: <parent><child attr=”test attribute”>text here</child></parent> Actual result: <parent> <child attr=”test attribute”> text here </child> </parent> I tried normalizing the xml using XmlUtil.serialize(),… Read More »

Calculate elapsed time in Java / Groovy

Questions: I have… Date start = new Date() … … … Date stop = new Date() I’d like to get the years, months, days, hours, minutes and seconds ellapsed between these two dates. — I’ll refine the question. I just want to get the elapsed time, as an absolute measure, that is without taking into… Read More »

create eclipse groovy-java project with maven

Questions: I have a Java-Groovy Eclipse project that I build with Maven. I have added the Maven Groovy plugin to the pom.xml such that I can build/test the Java and Groovy sources on the command-line using Maven. I would like to have some way to automatically generate the Eclipse .project and .classpath files from my… Read More »

Groovy – writing and formatting excel 2010

Questions: What are th options for working with an excel workbook from within a groovy (java) environment? We would like to be able to use the following features add sheets add cells: headings and data format columns, rows, cells and potentially form pivot tables copy the pivot table by value paste clipboard by value on… Read More »

Running a groovy script in eclipse

Questions: I’m currently writing some groovy scripts. Till now I simply use notepad and run the scripts via groovy script.groovy. But I’m looking some help for editing the files. So I tried eclipse with the groovy plugin which looks great…for groovy projects. But I just want to edit and run the groovy scripts. No Project… Read More »