1

I have a cells with text. Some of this cells have bold words. It's mean that I should join several cells in one with saving font style.

For example: enter image description here

I used OpenXML, something I did:

using(SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(@"C:\Users\anton.belenik\source\repos\openXML\openXML\SPG BY Glossary Anton.xlsx", true)) {
    string cellValue;
    int rowNumber = 0;
    WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;
    Sheet workSheet = workbookPart.Workbook.Descendants<Sheet>().Where(p => p.Name.Value.Equals("Sheet1")).FirstOrDefault();
    WorksheetPart worksheetPart = (WorksheetPart)(workbookPart.GetPartById(workSheet.Id));
    SheetData sheetData = worksheetPart.Worksheet.Elements<SheetData>().First();
    foreach(Row r in sheetData.Elements<Row>()) {
        rowNumber++;
        foreach(Cell c in r.Elements<Cell>()) {
            cellValue = GetCellValue(workbookPart, "Sheet1", c.CellReference);
        }
    }
Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
Ququruzik
  • 11
  • 2
  • 1
    Possible duplicate of [Create Merge Cells using OpenXML](https://stackoverflow.com/questions/37182232/create-merge-cells-using-openxml) – petelids Jul 01 '19 at 15:40

0 Answers0