WrapMode.WordWrap and TrimmingGranularity

Posted by: brian on 19 November 2020, 5:46 pm EST

  • Posted 19 November 2020, 5:46 pm EST

    Is there a way to get the TextLayout to perform ellipsis trimming if the WrapMode is set to WrapMode.WordWrap.

    We would like our users to be able to type in a box of a specified height and width, but show the ellipsis if it runs outside the containing box (MaxWidth, MaxHeight).

  • Posted 25 November 2020, 4:23 am EST

    Hi Brian,

    Trimming enables if WrapMode is NoWrap. So, it is not possible to have WrapMode set to WordWrap and be able to show Ellipsis.

    For details on the possible combinations, I would suggest to refer: https://www.grapecity.com/documents-api-imaging/demos/features/text/text-trimming/code-cs

    Regards,

  • Posted 25 November 2020, 1:44 pm EST

    I did see the documentation, which is what prompted the question. I’m still familiarizing myself with your library, is there path for me to do this manually? Maybe a combination of MeasureString and something?

    https://www.grapecity.com/documents-api-imaging/docs/online/GrapeCity.Documents.Imaging~GrapeCity.Documents.Drawing.GcGraphics~MeasureString(String,TextFormat,SizeF,TextSplitOptions,Int32).html?highlight=measurestring%2C

  • Posted 27 November 2020, 8:16 am EST

    Hello,

    I am discussing it with the team [ID: 2595] and will get back to you as soon as I receive information.

    Regards,

  • Posted 5 December 2020, 4:26 am EST

    Hi,

    You are suggested to refer: https://www.grapecity.com/documents-api-pdf/demos/features/text/text-trimming/pdf-cs

    GcPdf and GcImaging use the same TextLayout and GcGraphics, with identical (the same) API. So, the same TextLayout code/settings can be used to draw on a GcBitmap’s graphics.

    Therefore, you can take any of the GcImaging text rendering samples, and replace the code in it with the code from the GcPdf sample shared in the above mentioned link.

    Regards,

  • Posted 10 December 2020, 12:51 pm EST

    The link you sent me is the same as the GcImaging example. I’m assuming that means that there is no way for me to do this manually (my own code to mimic the behavior with WordWrap)?

    I was hoping that MeasureString could be used in conjunction with other API’s to get the desired result.

    Thanks for the response, I’ll continue to search and experiment.

  • Posted 11 December 2020, 4:07 am EST

    Hello Brian,

    Yes, other than this, there is no other way to implement your requirement.

    Regards,

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels