/// <summary> /// Processes the paragraph part. /// </summary> /// <param name="wkb">The WKB.</param> /// <param name="part">The part.</param> /// <param name="placeholder">The placeholder.</param> /// <param name="mapping">The mapping.</param> /// <param name="worksheetPart">The worksheet part.</param> /// <param name="reportWSPart">The report ws part.</param> /// <returns></returns> private static DrawingSpreadsheet.Shape ProcessParagraphPart(OpenXmlSpreadsheet.Workbook wkb, ExportPart part, MappingPlaceholder placeholder, ParagraphMapping mapping, WorksheetPart worksheetPart, WorksheetPart reportWSPart) { string SheetName = ""; uint RowStart = 0; uint RowEnd = 0; uint ColStart = 0; uint ColEnd = 0; // if no placeholder is specified then return now if (placeholder == null) { return(null); } DrawingSpreadsheet.Shape matchShape = worksheetPart.GetShapeByName(placeholder.Id); if (matchShape == null) { return(null); } // save the location of this shape, // this information will be used to position the incoming chart Extents extents = matchShape.ShapeProperties.Transform2D.Extents; Offset offset = matchShape.ShapeProperties.Transform2D.Offset; OpenXmlSpreadsheet.DefinedName rtfXmlDefinedName = wkb.GetDefinedNameByName(string.Format("{0}_{1}", part.DataSheetName, mapping.SourceFieldName)); wkb.BreakDownDefinedName(rtfXmlDefinedName, ref SheetName, ref RowStart, ref RowEnd, ref ColStart, ref ColEnd); WorksheetPart wksp = wkb.GetWorksheetPartByName(SheetName); OpenXmlSpreadsheet.SheetData sheetData = wksp.Worksheet.GetFirstChild <OpenXmlSpreadsheet.SheetData>(); OpenXmlSpreadsheet.Cell rtfXmlCell = sheetData.GetCell(ColStart, RowStart + 1); // Use the cell on the hidden data sheet as source for the XAML reader Section RTFSection = XamlSectionDocumentReader(rtfXmlCell.CellValue.InnerText); // The paragraph in the cell.inlinestring have a very different class structure to the paragraphs in the shape.textbody // So, the paragraph will need to go through a converter to do this. DrawingSpreadsheet.Shape targetShape = ConvertParagraph(worksheetPart, RTFSection, matchShape); // positon the new graphic frame after the shape its going to replace matchShape.Parent.InsertAfter <OpenXmlElement>(targetShape, matchShape); matchShape.Remove(); return(targetShape); }