Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4331

[CONNECT C++] Replace Text

$
0
0

I'm replacing text in a cell.  I enumerate the cell descriptor like this...

if (SUCCESS == mdlCell_getElmDscr (&cell, nullptr, &origin, nullptr, TrueScale, &rotation, nullptr, 0, 0, UpdateMasterFile, cellName, nullptr))
{
  const bool&  TakeOwnership  { true };
  const bool&  IsUnmodified   { true };
  EditElementHandle	header (cell, TakeOwnership, IsUnmodified);
  for (ChildEditElemIter component (header); component.IsValid (); component = component.ToNext ())
  {
    ITextEditP  editor  = component.GetITextEdit ();
    if (editor && editor->IsTextElement (component))
    {
      TextBlockPtr	textBlock = TextHandlerBase::GetFirstTextPartValue (component);
    }
  }
}

If the textBlock contains text that matches some criteria, I want to replace the text with new text.  I think that I need to use

editor->ReplaceTextPart (component, *textPart, *newBlock)

However, I'm unsure what I'm doing here.  Should that textPart be pointing to the text I want to replace?  If so, how do I get that TextPartId?  Or, am I barking up the wrong tree?


Viewing all articles
Browse latest Browse all 4331


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>