Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. How to merge cells/rows in flowdocument table?

How to merge cells/rows in flowdocument table?

Scheduled Pinned Locked Moved WPF
csharpwpfhelptutorialquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    John ph
    wrote on last edited by
    #1

    I have been trying to implement merge cells/rows feature in WPF richtextbox containing flowdocument with table. found no built-in method which supports table.merge(tablecells). One way i think is to get the table cells in selection, set rowspan, colspan accordingly for the left most cell and remove other cells in the selection. but fidning it difficult even to get the cells in the selection

    foreach (var rowGroup in table.RowGroups)
    {
    foreach (var row in rowGroup.Rows)
    {
    foreach (var cell in row.Cells)
    {
    if (richTextBox.Selection.Contains(cell.ElementStart))
    {
    int rowIndex = rowGroup.Rows.IndexOf(row);
    int colIndex = row.Cells.IndexOf(cell);
    selectedTableCells.Add(new KeyValuePair<int, int>(rowIndex, colIndex), cell);
    }
    }
    }
    }

    code above doesnot return the correct number of cells in the selection. any help? Is there a better way to do this?

    - Regards -
       J O N


    A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers


    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups