Ok the solution I found was:
searching throught the cell elements getting all paragraphs,
searching through all paragraph elements and getting all formattedTexts
searching through all FormattedText elements and getting all Texts,
then searching each Text.Content and changing it when the value I want to change is found.
this method is not failt proof, but it will work for me since I know I only use it when I have 1 Paragraph with 1 FormattedText and 1 Text element inside the cell.
the code for anyone who wants it:
Code:
// I wrote this in notepad++, because the actual method has some sensitive data, but this should work
public bool ChangeTextValue(this MigraDoc.DocumentObjectModel.Tables.Cell cell, string oldValue, string newValue)
{
for(int i = 0; i < cell.Elements.Count; ++i)
{
if(cell.Elements[i] is Paragraph)
{
var p = cell.Elements[i];
for(int j = 0; j < p.Elements.Count; ++j)
{
if(p.Elements[j] is FormattedText)
{
var ft = p.Elements[j];
for(int l = 0; l < ft.Elements.Count; ++l)
{
if(ft.Elements[l] is Text && ((Text)ft.Elements[l]).Content.Contains(oldValue))
{
((Text)ft.Elements[l]).Content = newValue;
return true; // found the value / updated it
}
}
}
}
}
}
return false; // didn't find the value / didn't update
}