From ab319d5a59cac9c1585cf19e735351c2a84c888c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nut=2E=E0=B9=84=E0=B8=9B=E0=B9=80=E0=B8=A3=E0=B8=B7?= =?UTF-8?q?=E0=B9=88=E0=B8=AD=E0=B8=A2?= Date: Tue, 8 Sep 2026 20:37:09 +0700 Subject: [PATCH] fix(form_1_2): truncate at last word boundary instead of mid-word MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced the inline Substring-based truncation (which cut mid-word, e.g. "...เนื่องจากป") with a TruncateAtWord() helper in the report's ScriptText that backs off to the last space before the length limit when one exists, falling back to a hard cut only when the text has no spaces at all within that range (common in run-on Thai text). Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_0153wBt23EjW125ZsADwWVAs --- .../change_position_offer_request_form.frx | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/wwwroot/reports/change_position_offer_request_form.frx b/wwwroot/reports/change_position_offer_request_form.frx index bfdfb38..6899364 100644 --- a/wwwroot/reports/change_position_offer_request_form.frx +++ b/wwwroot/reports/change_position_offer_request_form.frx @@ -1,5 +1,39 @@ + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + // ตัดข้อความยาวเกินที่จุดเว้นวรรคสุดท้ายก่อน maxLen แทนการตัดกลางคำตรง ๆ + // (ถ้าไม่มีช่องว่างเลยในช่วงนั้น เช่น ข้อความไทยติดกันยาว ๆ จะตัดตรง maxLen เหมือนเดิม) + public static string TruncateAtWord(string text, int maxLen) + { + if (string.IsNullOrEmpty(text) || text.Length <= maxLen) return text; + string cut = text.Substring(0, maxLen); + int lastSpace = cut.LastIndexOf(' '); + if (lastSpace > 0) + { + cut = cut.Substring(0, lastSpace); + } + return cut + "..."; + } + } +} + @@ -80,7 +114,7 @@ - + @@ -139,11 +173,11 @@ - - + + - +