Стартовая страница › Форумы › Понять, как работает ПО › Гибкий отчет. ExcelStyleCustom.xml
- В этой теме 8 ответов, 2 участника, последнее обновление 11 месяцев, 2 недели назад сделано
Mikhail.
-
АвторСообщения
-
04.07.2025 в 14:45 #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
В какую сторону копать?04.07.2025 в 15:45 #39327
MikhailМодераторДобрый день!
Плагин берёт ширину столбцов для Excel-документов из файлов ExcelStyleDefault.xml и ExcelStyleCustom.xml.
Возможная причина в том, что нужно полностью остановить и запустить веб-приложение, чтобы изменения в этих файлах считались плагином.04.07.2025 в 16:21 #39329Evgeniy58
Участник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/sWRMOTnY3Bk04.07.2025 в 16:41 #39330Evgeniy58
УчастникНа изменения ExcelStyleDefault отчёт реагирует. Ширина столбцов меняется… Но по инструкции его править не нужно…
Кстати при обновлении плагина ExcelStyleCustom.xml затирается на файл из архива …07.07.2025 в 14:05 #39334
MikhailМодераторПроверю, напишу в эту тему.
07.07.2025 в 14:12 #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>Добавим в документацию.
07.07.2025 в 14:14 #39336
MikhailМодераторКстати при обновлении плагина ExcelStyleCustom.xml затирается на файл из архива
Учитывая, что файл стилей прописывается в отчёте, дайте ему другое имя.
09.07.2025 в 13:57 #39361Evgeniy58
Участник<StyleSheet>Custom</StyleSheet>
Спасибо, так заработало.!09.07.2025 в 16:53 #39369
MikhailМодераторВы первый, кто использовал эту функцию 🙂
-
АвторСообщения
- Для ответа в этой теме необходимо авторизоваться.