Гибкий отчет. ExcelStyleCustom.xml

Стартовая страница Форумы Понять, как работает ПО Гибкий отчет. ExcelStyleCustom.xml

Просмотр 9 сообщений - с 1 по 9 (из 9 всего)
  • Автор
    Сообщения
  • #39323
    Evgeniy58
    Участник

    Всем привет. Прошу помощи кто занимался с кастомизацией отчетов в плагине «Гибкие отчеты. Захотел увеличить ширину первого столбца и изменить выравнивание на Left.(для Excel) Но ни одна правка не сработала.
    Начал играться хотя бы с переопределением стандартных стилей вExcelStyleCustom.xml (поменял размер шрифта), а внесенные изменения не срабатывают.

    <?xml version="1.0" encoding="utf-8" ?>
    <ExcelStyles>
      <!-- You can add new styles and override the existing styles defined in PdfStyleDefault.xml -->
      
      <ColumnWidths>
        <!-- Add your column widths here -->
      </ColumnWidths>
    
      <RowHeights>
        <!-- Add your row heights here -->
      </RowHeights>
      
      <Styles>
        <!-- Add your styles here -->
    	    <!-- Default style -->
        <Style>
          <Name>default-style</Name>
          <Font>
            <Size>26</Size>
          </Font>
          <Alignment>
            <Horizontal>Left</Horizontal>
            <Vertical>Center</Vertical>
          </Alignment>
        </Style>
    
        <!-- Row styles -->
        <Style>
          <Name>row-heading</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Size>20</Size>
            <Bold>true</Bold>
          </Font>
        </Style>
    
        <Style>
          <Name>row-subheading</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Size>162</Size>
            <Bold>true</Bold>
          </Font>
          <Alignment>
            <Vertical>Bottom</Vertical>
          </Alignment>
        </Style>
    
        <Style>
          <Name>row-info</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Size>16</Size>
          </Font>
        </Style>
    
        <Style>
          <Name>row-header</Name>
          <BaseStyle>default-style</BaseStyle>
        </Style>
    
        <Style>
          <Name>row-group</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Bold>true</Bold>
          </Font>
        </Style>
    
        <Style>
          <Name>row-total</Name>
          <BaseStyle>default-style</BaseStyle>
        </Style>
    
        <Style>
          <Name>row-default</Name>
          <BaseStyle>default-style</BaseStyle>
        </Style>
    
        <!-- Cell styles -->
        <Style>
          <Name>cell-heading</Name>
        </Style>
    
        <Style>
          <Name>cell-subheading</Name>
        </Style>
    
        <Style>
          <Name>cell-info</Name>
        </Style>
    
        <Style>
          <Name>cell-col-hdr</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Bold>true</Bold>
          </Font>
          <Alignment>
            <Horizontal>Center</Horizontal>
          </Alignment>
          <Fill>
            <BackgroundColor>#FFCCCCCC</BackgroundColor>
          </Fill>
        </Style>
    
        <Style>
          <Name>cell-row-hdr</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Bold>true</Bold>
          </Font>
          <Alignment>
            <Horizontal>Center</Horizontal>
          </Alignment>
        </Style>
    
        <Style>
          <Name>cell-group</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Bold>true</Bold>
          </Font>
          <Alignment>
            <Horizontal>Center</Horizontal>
          </Alignment>
        </Style>
    
        <Style>
          <Name>cell-data</Name>
          <BaseStyle>default-style</BaseStyle>
          <Alignment>
            <Horizontal>Center</Horizontal>
          </Alignment>
        </Style>
    
        <Style>
          <Name>cell-total</Name>
          <BaseStyle>cell-col-hdr</BaseStyle>
        </Style>
    
        <Style>
          <Name>cell-default</Name>
          <BaseStyle>default-style</BaseStyle>
        </Style>
    
        <Style>
          <Name>cell-center</Name>
          <BaseStyle>default-style</BaseStyle>
          <Alignment>
            <Horizontal>Center</Horizontal>
          </Alignment>
        </Style>
      </Styles>
    </ExcelStyles>
    

    Цель в секции DataData увеличить ширину первого столбца и выравнивание по левому краю.
    https://skrinshoter.ru/sWRMZ3GyaFn
    В какую сторону копать?

    #39327
    Mikhail
    Модератор

    Добрый день!
    Плагин берёт ширину столбцов для Excel-документов из файлов ExcelStyleDefault.xml и ExcelStyleCustom.xml.
    Возможная причина в том, что нужно полностью остановить и запустить веб-приложение, чтобы изменения в этих файлах считались плагином.

    #39329
    Evgeniy58
    Участник

    C:\SCADA\ScadaWeb\wwwroot\plugins\ElasticReport\templates\ExcelStyleCustom.xml

    <?xml version="1.0" encoding="utf-8" ?>
    <ExcelStyles>
      <!-- You can add new styles and override the existing styles defined in PdfStyleDefault.xml -->
      
      <ColumnWidths>
        <ColumnWidth style="col-long-time" value="100" />
        <ColumnWidth style="col-short-time" value="100" />
        <ColumnWidth style="col-name" value="100" />
        <ColumnWidth style="col-total" value="100" />
        <ColumnWidth style="col-default" value="100" />
        <ColumnWidth style="col-xs" value="100" />
        <ColumnWidth style="col-sm" value="100" />
        <ColumnWidth style="col-lg" value="100" />
        <ColumnWidth style="col-xl" value="100" />
      </ColumnWidths>
      
      <RowHeights>
        <RowHeight style="row-heading" value="100" />
        <RowHeight style="row-subheading" value="100" />
        <RowHeight style="row-info" value="100" />
        <RowHeight style="row-header" value="100" />
        <RowHeight style="row-group" value="100" />
        <RowHeight style="row-total" value="100" />
        <RowHeight style="row-default" value="100" />
        <RowHeight style="row-xs" value="100" />
        <RowHeight style="row-sm" value="100" />
        <RowHeight style="row-lg" value="100" />
        <RowHeight style="row-xl" value="100" />
      </RowHeights>
      
      <Styles>
        <!-- Add your styles here -->
    	    <!-- Default style -->
        <Style>
          <Name>default-style</Name>
          <Font>
            <Size>26</Size>
          </Font>
          <Alignment>
            <Horizontal>Left</Horizontal>
            <Vertical>Center</Vertical>
          </Alignment>
        </Style>
    
        <!-- Row styles -->
        <Style>
          <Name>row-heading</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Size>20</Size>
            <Bold>true</Bold>
          </Font>
        </Style>
    
        <Style>
          <Name>row-subheading</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Size>162</Size>
            <Bold>true</Bold>
          </Font>
          <Alignment>
            <Vertical>Bottom</Vertical>
          </Alignment>
        </Style>
    
        <Style>
          <Name>row-info</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Size>16</Size>
          </Font>
        </Style>
    
        <Style>
          <Name>row-header</Name>
          <BaseStyle>default-style</BaseStyle>
        </Style>
    
        <Style>
          <Name>row-group</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Bold>true</Bold>
          </Font>
        </Style>
    
        <Style>
          <Name>row-total</Name>
          <BaseStyle>default-style</BaseStyle>
        </Style>
    
        <Style>
          <Name>row-default</Name>
          <BaseStyle>default-style</BaseStyle>
        </Style>
    
        <!-- Cell styles -->
        <Style>
          <Name>cell-heading</Name>
        </Style>
    
        <Style>
          <Name>cell-subheading</Name>
        </Style>
    
        <Style>
          <Name>cell-info</Name>
        </Style>
    
        <Style>
          <Name>cell-col-hdr</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Bold>true</Bold>
          </Font>
          <Alignment>
            <Horizontal>Center</Horizontal>
          </Alignment>
          <Fill>
            <BackgroundColor>#FFCCCCCC</BackgroundColor>
          </Fill>
        </Style>
    
        <Style>
          <Name>cell-row-hdr</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Bold>true</Bold>
          </Font>
          <Alignment>
            <Horizontal>Center</Horizontal>
          </Alignment>
        </Style>
    
        <Style>
          <Name>cell-group</Name>
          <BaseStyle>default-style</BaseStyle>
          <Font>
            <Bold>true</Bold>
          </Font>
          <Alignment>
            <Horizontal>Center</Horizontal>
          </Alignment>
        </Style>
    
        <Style>
          <Name>cell-data</Name>
          <BaseStyle>default-style</BaseStyle>
          <Alignment>
            <Horizontal>Center</Horizontal>
          </Alignment>
        </Style>
    
        <Style>
          <Name>cell-total</Name>
          <BaseStyle>cell-col-hdr</BaseStyle>
        </Style>
    
        <Style>
          <Name>cell-default</Name>
          <BaseStyle>default-style</BaseStyle>
        </Style>
    
        <Style>
          <Name>cell-center</Name>
          <BaseStyle>default-style</BaseStyle>
          <Alignment>
            <Horizontal>Center</Horizontal>
          </Alignment>
        </Style>
      </Styles>
    </ExcelStyles>
    

    Сейчас сделал вот такой конфиг. Перезапустил со всеми галочками с перезагрузкой всех сервисов.
    https://skrinshoter.ru/sWROwFDQJMB
    И ничего не поменялось..
    https://skr.sh/sWRMOTnY3Bk

    #39330
    Evgeniy58
    Участник

    На изменения ExcelStyleDefault отчёт реагирует. Ширина столбцов меняется… Но по инструкции его править не нужно…
    Кстати при обновлении плагина ExcelStyleCustom.xml затирается на файл из архива …

    #39334
    Mikhail
    Модератор

    Проверю, напишу в эту тему.

    #39335
    Mikhail
    Модератор

    Выяснилось, что в файле отчёта в раздел OutputOptions нужно прописать суффикс файла стилей:

      <OutputOptions>
        <!-- Page format: A0, A1, A2, A3, A4, A5, A6, B5, Letter, Legal, Ledger or P11x17 -->
        <PageFormat>A4</PageFormat>
        <!-- Page orientation: Portrait or Landscape -->
        <Orientation>Landscape</Orientation>
        <!-- Specifies custom report styles -->
        <StyleSheet>Custom</StyleSheet>
      </OutputOptions>
    

    Добавим в документацию.

    #39336
    Mikhail
    Модератор

    Кстати при обновлении плагина ExcelStyleCustom.xml затирается на файл из архива

    Учитывая, что файл стилей прописывается в отчёте, дайте ему другое имя.

    #39361
    Evgeniy58
    Участник

    <StyleSheet>Custom</StyleSheet>
    Спасибо, так заработало.!

    #39369
    Mikhail
    Модератор

    Вы первый, кто использовал эту функцию 🙂

Просмотр 9 сообщений - с 1 по 9 (из 9 всего)
  • Для ответа в этой теме необходимо авторизоваться.