Free Support Forum - aspose.com

Is there any way to wrap a text while updating a TEXTLAYER in PSD file?

I want to update a text in TEXTLAYER and wrap it in a particular layer. Is there any possibility to do the same?

Layer appNameLayer = findLayer("App name something",psdImage);
        if(null != appNameLayer){
            TextLayer appNameTextLayer = (TextLayer) appNameLayer;
            appNameTextLayer.updateText(appModel.getTitle());
        }

appModel.getTitle is a long Text and wanted to wrap this text.

@mail9deep

For Aspose.PSD, if the Layer that you are updating has bounds, then Aspose.PSD will automatically wrap words. If layer hasn’t bounds, then it’s possible to set them using Set/Get TextBounds.

You can add \r char to the places where you want to do a wrap. Like

textLayer.UpdateText("abc\rdefg\rhklmnop\r"); //This should be testes for Java.` 

If the text is really long, then you have only one option - use ITextPortion API.

textLayer.getTextData() and then add new text portions. You can please check the API reference guide for IText along with example.