I'm using a template to generate a document with a table in it. I'm adding the table, from scratch, to the document dynamically. This all exists in an ASP.Net MVC application. The table is being built ok. The only thing is I can't get it to take on the inbuilt Word table style I want. It doesn't matter what style i stry, it's not working.
See code example.
01.private static void BuildScheduleItemsTable(RadFlowDocument document,02. RadFlowDocumentEditor editor,03. ScheduleOfWork scheduleOfWork,04. ScheduleStage scheduleStage = ScheduleStage.Preliminary,05. ScheduleRecipient scheduleRecipient = ScheduleRecipient.Customer)06. {07. List<ScheduleOfWorkItem> scheduleOfWorkItems =08. GetScheduleOfWorkItemsFor(scheduleOfWork.ScheduleOfWorkID, scheduleStage);09. 10. 11. Table table = editor.InsertTable(scheduleOfWorkItems.Count + 1, 5);12. table.StyleId = "MediumGrid3-Accent4";13. table.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Auto);14. table.LayoutType = TableLayoutType.AutoFit;15. 16. // create header row17. TableRow headerRow = table.Rows[0];18. headerRow.RepeatOnEveryPage = true; 19. //headerRow.CanSplit = false;20. //headerRow.RepeatOnEveryPage = true; // header row repeats when new page21. headerRow.AddHeaderCellAndText("Description", 0);22. headerRow.AddHeaderCellAndText("Quantity", 1);23. headerRow.AddHeaderCellAndText("Cost", 2);24. headerRow.AddHeaderCellAndText("VAT Amount", 3);25. headerRow.AddHeaderCellAndText("Total Cost Inc VAT", 4);26. 27. int rowIter = 1;28. foreach (ScheduleOfWorkItem scheduleOfWorkItem in scheduleOfWorkItems)29. {30. TableRow itemRow = table.Rows[rowIter];31. //itemRow.CanSplit = false;32. itemRow.UpdateDescriptionCell(scheduleOfWorkItem, scheduleRecipient);33. itemRow.UpdateQuantityCell(scheduleOfWorkItem);34. itemRow.UpdateCostCell(scheduleOfWorkItem);35. itemRow.UpdateVatAmountCell(scheduleOfWorkItem);36. itemRow.UpdateTotalCostIncVatCell(scheduleOfWorkItem);37. rowIter++;38. }39. }
The Update...Cell and AddHeaderCellAndText methods are just methods that create paragraphs and runs inside the cells that were created when the table was created. No matter what I set in table.StyleId it doesn't seem to take effect
