trichview.com

trichview.support




Re: Convert text to plain in C++


Return to index


Author

Message

Sergey Tkachenko

Posted: 11/04/2004 22:05:57


void RemoveFormatting(TCustomRVData* RVData)

{

  for (int i=RVData->ItemCount-1; i>=0; i--)

  {

    RVData->GetItem(i)->ParaNo = 0;

    int StyleNo = RVData->GetItemStyle(i);

    if (StyleNo==rvsTable)

    {

      TRVTableItemInfo* table = (TRVTableItemInfo*)(RVData->GetItem(i));

      for (int r=0; r<table->Rows->Count; r++)

        for (int c=0; c<table->Rows->Items[r]->Count; c++)

          if (table->Cells[r][c])

            RemoveFormatting(table->Cells[r][c]->GetRVData());

    }

    else if (StyleNo==rvsListMarker)

      RVData->RemoveListMarker(i);

    else if (StyleNo>=0 &&

      RVData->GetRVStyle()->TextStyles->Items[0]->Unicode==

      RVData->GetRVStyle()->TextStyles->Items[StyleNo]->Unicode)

    {

      RVData->GetItem(i)->StyleNo = 0;

      RVData->SetItemTag(i, 0);

    }

  }

}


Call:

RemoveFormatting(RichViewEdit1->RVData);

RichViewEdit1->ClearUndo();

RichViewEdit1->Format();






Powered by ABC Amber Outlook Express Converter