C# Openxml WordProccesing

I am working on a project and i wan to generate a report to values that a bot complicated so i need to make 2 rows inside one cell can u help me with it
this is my code of making a a table but i want to make it do it without ruining the other rows

on cell 25 i want to make that it takes 2 rows inside that cell to show to values as well as 26, 27, 28 and 29

this is my code
private void AddObjTable(WordprocessingDocument doc, ObjectivesDTO data)
{

// Get the main document part
MainDocumentPart mainPart = doc.MainDocumentPart;

// Get the body of the document
Body body = mainPart.Document.Body;

// Create a new table
Table table1 = new Table();

// Set table width to 50% (optional, adjust as needed)
table1.AppendChild(new TableProperties(
     new TableWidth() { Type = TableWidthUnitValues.Dxa, Width = "100%" },
        new TableBorders(
            new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 1 },
            new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 1 },
            new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 1 },
            new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 1 },
            new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 1 },
            new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 1 }
        )
    ));

TableRow headerRow = new TableRow();
TableCell cell11 = CreateTableCellWithTextAndProperties("", 2, "e4d2ae");
TableCell cell12 = CreateTableCellWithTextAndProperties("", 20, "e4d2ae");
TableCell cell13 = CreateTableCellWithTextAndProperties("", 35, "e4d2ae");
TableCell cell14 = CreateTableCellWithTextAndProperties("", 14, "e4d2ae");
TableCell cell15 = CreateTableCellWithTextAndProperties("", 6, "9a7732");
TableCell cell16 = CreateTableCellWithTextAndProperties("", 6, "9a7732");
TableCell cell17 = CreateTableCellWithTextAndProperties("", 6, "9a7732");
TableCell cell18 = CreateTableCellWithTextAndProperties("", 6, "9a7732");
TableCell cell19 = CreateTableCellWithTextAndProperties("", 6, "9a7732");
headerRow.Append(cell19, cell18, cell17, cell16, cell15, cell14, cell13, cell12, cell11);
table1.Append(headerRow);

foreach (var obj in data.kPIMainDTOs)
{       
    
        TableRow row = new TableRow();
        TableCell cell21 = CreateTableCellWithTextAndProperties("", 2, "ffffff");
        TableCell cell22 = CreateTableCellWithTextAndProperties("", 20, "ffffff");
        TableCell cell23 = CreateTableCellWithTextAndProperties("", 35, "ffffff");
        TableCell cell24 = CreateTableCellWithTextAndProperties("", 14, "ffffff");

        TableCell cell25 = CreateTableCellWithTextAndProperties("", 6, "ffffff");
        
        TableCell cell26 = CreateTableCellWithTextAndProperties("", 6, "ffffff");
        
        TableCell cell27 = CreateTableCellWithTextAndProperties("", 6, "ffffff");
        
        TableCell cell28 = CreateTableCellWithTextAndProperties("", 6, "ffffff");
        
        TableCell cell29 = CreateTableCellWithTextAndProperties("", 6, "ffffff");
        
        row.Append(cell29, cell28, cell27, cell26, cell25, cell24, cell23, cell22, cell21);
        table1.Append(row);
    
}



foreach (var paragraph in doc.MainDocumentPart.Document.Descendants<Paragraph>())
{
    var text = paragraph.InnerText;
    if (text.Contains("@Table"))
    {
        // Clear the paragraph content
        paragraph.RemoveAllChildren();

        // Create paragraph properties for center alignment
        ParagraphProperties paragraphProperties = new ParagraphProperties(
            new Justification() { Val = JustificationValues.Center }
        );

        // Apply the paragraph properties to the paragraph
        paragraph.Append(paragraphProperties);

        // Insert the table before the paragraph
        paragraph.Parent.InsertBefore(table1, paragraph);

        // Remove the paragraph containing the search text
        paragraph.Remove();
    }
}

}

New contributor

mohamadhammdan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật