private void RenderDocx(string fileName) { // Does not parse through section headers yet var parser = new USFMParser(new List <string> { "s5" }); var renderer = new DocxRenderer(BuildDocxConfig()); var usfm = new USFMDocument(); var progress = fileDataGrid.RowCount - 1; var progressStep = 0; foreach (DataGridViewRow row in fileDataGrid.Rows) { var cell = row.Cells[0]; if (cell.Value == null) { continue; } var filename = cell.Value.ToString(); var text = File.ReadAllText(filename); usfm.Insert(parser.ParseFromString(text)); progressStep++; LoadingBar.Value = (int)(progressStep / (float)progress * 100); } var output = renderer.Render(usfm); using (Stream outputStream = File.Create(fileName)) { output.Write(outputStream); } }
public void SetUpTestCase() { configDocx = new DocxConfig(); parser = new USFMParser(); render = new DocxRenderer(); }