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 »

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 »

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 »

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 »