private static void WriteHeader(JiraConnector.HtmlWriter htmlWriter) { htmlWriter.WriteFullBeginTag("head"); htmlWriter.WriteFullBeginTag("style"); htmlWriter.Write("td { padding:20px; margin:16px; }"); htmlWriter.WriteEndTag("style"); htmlWriter.WriteEndTag("head"); }
public void WriteRowHtml(DateTime date, JiraConnector.HtmlWriter htmlWriter) { htmlWriter.WriteFullBeginTag("tr"); htmlWriter.WriteBeginTag("td"); htmlWriter.WriteAttribute("colspan", "3"); WriteTextStyle(htmlWriter, "#222222", "21px"); htmlWriter.Write(date.ToString("D")); htmlWriter.WriteEndTag("span"); htmlWriter.WriteEndTag("td"); htmlWriter.WriteEndTag("tr"); }
public void WriteReport(List <JiraTimeEntry> timeEntries) { DateTime lastStartDateTime = DateTime.MinValue; StreamWriter streamWriter = new StreamWriter("C:\\1_Development\\Projects\\JiraWorklogReport\\worklogAdp.html"); using (JiraConnector.HtmlWriter htmlWriter = new JiraConnector.HtmlWriter(streamWriter)) { htmlWriter.WriteFullBeginTag("html"); WriteHeader(htmlWriter); WriteBodyTag(htmlWriter); foreach (JiraTimeEntry timeEntry in timeEntries) { DateTime startedLocal = timeEntry.StartedLocal; if (lastStartDateTime.Date != startedLocal.Date) { if (lastStartDateTime != DateTime.MinValue) { //if the values are the same then we haven't started a table htmlWriter.WriteEndTag("table"); htmlWriter.WriteBreak(); } //write new table WriteBeginTableTag(htmlWriter); WriteRowHtml(startedLocal, htmlWriter); } //Write the issue name, duration, start time and end time WriteRowHtml(timeEntry, htmlWriter); lastStartDateTime = startedLocal; //hold onto the date, so the new table is only written when a new date is encounterd } htmlWriter.WriteEndTag("table"); htmlWriter.WriteEndTag("html"); htmlWriter.Flush(); htmlWriter.Close(); } }