[FREngine 11] Change Other Block to TextBlock

  • 1.4K Views
  • Last Post 06 June 2014
vbknight posted this 24 January 2014

how can i change block type to FREngine.BlockTypeEnum.BT_Text

e.i if i have a table block i want to change it during runtime to a text block.

thanks

Order By: Standard | Newest | Votes
SDK_support posted this 24 January 2014

Please use IBlock::Type property for this. For more information see Help → API Reference → Layout-Related Objects → Block. Please note that this property is a read-only, for information about how to work with such properties, please see Help → Guided Tour → Advanced Techniques → Working with Properties.

vbknight posted this 07 March 2014

block type is defined at the creation and cannot be changed. You can only change it by deleting the block and replacing it with the correct type.

SDK_support posted this 07 March 2014

Yes, just copy the region of the block you need to replace to another Region object with the help of the IRegion::CopyFrom method, then delete the old block from the layout by calling the ILayoutBlocks::DeleteAt method and finally create a new block of the desired type and add it into the desired layout by calling the AddNew method of the Layout object.

Antonio posted this 06 June 2014

Sorry ... but If I create a new button in the Toolbar: - I can insert ourselves the code to invoke the Command that turns a block of type picture of a block of type text; - Make a loop on all the blocks in the document and save the file in a text contained in the blocks through education GetAsTextBlock.

I think it is the principle on which is based the previous comment!

Close