WrapMode.WordWrap and TrimmingGranularity

Posted by: brian on 19 November 2020, 8:46 am EST

  • Posted 19 November 2020, 8:46 am 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 24 November 2020, 7:23 pm 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, 4:44 am 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 26 November 2020, 11:16 pm 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 4 December 2020, 7:26 pm 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, 3:51 am 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 10 December 2020, 7:07 pm 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