Fast Report For Fmx 2

отредактировано September 2019 Раздел: FastReport VCL
Приветствую!
Не нашёл соответствующий раздел, поэтому пишу здесь.
У нас есть купленный Fast Report for FMX.

При добавлении нового подотчёта к уже трём имеющимся падает на очень странном участке кода. После правки стало норм. В логике мне разбираться некогда. Пишу для разработчиков. Вот участок кода на котором падал FR:
Юнит Fmx.FrxClass
function TfrxCustomMemoView.DrawPart: Double;
....

      for nIndex := 1 to Length(FPartMemo) do
      begin
        r := RectF(0, 0, FTextRect.Width, 10000);
        if (FPartMemo[nIndex] = #9) or (FPartMemo[nIndex] = ' ') or
          (FPartMemo[nIndex] = #13) or (FPartMemo[nIndex] = #10) or
          (nIndex = Length(FPartMemo)) then
        begin
          if nIndex = LWordIndex then
            continue;

          s2 := s2 + Copy(FPartMemo, LWordIndex, nIndex - LWordIndex);

          if (nIndex = Length(FPartMemo)) then
            s2 := s2 + FPartMemo[nIndex];
          TextCanvas.MeasureText(r, s2, FWordWrap, [],
            frxHAlignToTextAlign(FHAlign), frxVAlignToTextAlign(FVAlign));

          if (r.Height > Height) or (nIndex = Length(FPartMemo)) then
          begin
            { delete part only if text doesnt fit }
            if (r.Height > Height) then
              Delete(s2, Length(s2) - (nIndex - LWordIndex - 1), (nIndex - LWordIndex))
            else
              PrevH := r.Height;
            { copy part that fit into bounds }
            FMemo.Text := Copy(FPartMemo, 1, Length(s2));

            { check if we have wrap at spec symbol and correct outbound text }
            if (s2 <> '') and (Length(FPartMemo) > 1) then
            begin
              if FPartMemo[LWordIndex] = #13 then
                Delete(FPartMemo, LWordIndex, 1);
              if (LWordIndex <= Length(FPartMemo)) and (FPartMemo[LWordIndex] = #10) then
                Delete(FPartMemo, LWordIndex, 1);
              if (LWordIndex <= Length(FPartMemo)) and (FPartMemo[LWordIndex] = ' ') then
                Delete(FPartMemo, LWordIndex, 1);
            end;
            { correct outbound text }
            if (Length(FPartMemo) > 0) and (Length(FPartMemo) >= Length(s2)) then
              Delete(FPartMemo, 1, Length(s2));
            { return unused height }
            if s2 = '' then
              Result := Height
            else if FPartMemo = '' then
              Result := 0
            else
              Result := Height - PrevH;
            break;
          end;
          { save current height we dont want to calculate it twice }
          PrevH := r.Height;
          LWordIndex := nIndex;
        end;
      end;

Комментарии

  • отредактировано September 2019
    А что именно в нём странное и после какой правки стало норм?
  • отредактировано 14:49
    Nashev написал: »
    А что именно в нём странное и после какой правки стало норм?

    Было:
                  if FPartMemo[LWordIndex] = #13 then
                    Delete(FPartMemo, LWordIndex, Length(sLineBreak));
                  if FPartMemo[LWordIndex] = #10 then
                    Delete(FPartMemo, LWordIndex, 1);
                  if FPartMemo[LWordIndex] = ' ' then
                    Delete(FPartMemo, LWordIndex, 1);
    

    Стало:
                  if FPartMemo[LWordIndex] = #13 then
                    Delete(FPartMemo, LWordIndex, 1);
                  if (LWordIndex <= Length(FPartMemo)) and (FPartMemo[LWordIndex] = #10) then
                    Delete(FPartMemo, LWordIndex, 1);
                  if (LWordIndex <= Length(FPartMemo)) and (FPartMemo[LWordIndex] = ' ') then
                    Delete(FPartMemo, LWordIndex, 1);
    

    Т.е. если встали на конец строки с элементами #13, #10 в вашем случае получим AV.

    Кроме того, не работает PrepareReport(false) если передавать false для того что бы не убивал предыдущий отчёт - всё равно его чистит. Тоже пришлось править.

Оставить комментарий

Многофункциональный текстовый редактор. Чтобы отредактировать стиль параграфа, нажмите TAB, чтобы перейти к меню абзаца. Там вы можете выбрать стиль. По умолчанию не выбран ни один стиль. Когда вы выберете текст, появится встроенное меню форматирования. Нажмите TAB, чтобы войти в него. Некоторые элементы, такие как многофункциональные вставки ссылок, картинок, индикаторов загрузки и сообщений об ошибок могут быть вставлены в редактор. Вы можете перемещаться по ним, используя стрелки внутри редактора и удалять с помощью клавиш delete или backspace.