0
我正在使用下面的代碼來將填充應用於InlineGraphicElement,但它似乎只應用該值並且未將其刪除。如何從TLF中的FlowElement中刪除樣式?
imageFloat = inlineGraphicElement.float;
newFormat = new TextLayoutFormat();
if (imageFloat==Float.LEFT || imageFloat==Float.START) {
newFormat.paddingRight = 5;
inlineGraphicElement.paddingRight = 5;
}
else if (imageFloat==Float.RIGHT || imageFloat==Float.END) {
newFormat.paddingLeft = 5;
inlineGraphicElement.paddingLeft = 5;
}
else {
newFormat.paddingLeft = undefined;
newFormat.paddingRight = undefined;
}
absoluteStart = inlineGraphicElement.getAbsoluteStart();
textContainerManager = richEditableText.mx_internal::textContainerManager as RichEditableTextContainerManager;
textContainerManager.applyFormatOperation(newFormat, null, null, absoluteStart, absoluteStart+1);
它看起來像忽略未定義的值。現在我不確定如何將填充重置爲無。
UPDATE:
我發現在編輯管理類clearFormat方法:
editManager = richEditableText.textFlow.interactionManager as IEditManager;
currentFormat = new TextLayoutFormat();
currentFormat.paddingLeft = 1;
currentFormat.paddingRight = 1;
editManager.clearFormat(currentFormat, null, null);
我不知道這是正確的,但。但是,如果它似乎工作,我會添加它作爲答案。
看來,如果選擇延伸到段落上,它不會刪除格式。 –