Repository: PHPOffice/PhpSpreadsheet (php)

Issue:
Feature request: XML-Reader should recognize indents
Again, some minor feature request: The XML-Reader so far does not recognize indents. This can easily be fixed by adding a new branch in `Reader/Xml/Style/Alignment.php`:

```
case 'Indent':
    $style['alignment']['indent'] = $styleAttributeValue;
    break;
```

And btw, thank you for your great work! Especially the XML reader makes my life so much easier.

Pull request:
XML Reader Recognize Indents
Fix #4448

This is:

- [ ] a bugfix
- [x] a new feature
- [ ] refactoring
- [ ] additional unit tests

Checklist:

- [ ] Changes are covered by unit tests
  - [ ] Changes are covered by existing unit tests
  - [x] New unit tests have been added
- [x] Code style is respected
- [x] Commit message explains **why** the change is made (see https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
- [ ] CHANGELOG.md contains a short summary of the change and a link to the pull request if applicable
- [ ] Documentation is updated as necessary

### Why this change is needed?

Provide an explanation of why this change is needed, with links to any Issues (if appropriate).
If this is a bugfix or a new feature, and there are no existing Issues, then please also create an issue that will make it easier to track progress with this PR.


Patch:
diff --git a/src/PhpSpreadsheet/Reader/Xml/Style/Alignment.php b/src/PhpSpreadsheet/Reader/Xml/Style/Alignment.php
index d1363548b..7bbda1348 100644
--- a/src/PhpSpreadsheet/Reader/Xml/Style/Alignment.php
+++ b/src/PhpSpreadsheet/Reader/Xml/Style/Alignment.php
@@ -49,6 +49,10 @@ class Alignment extends StyleBase
                 case 'Rotate':
                     $style['alignment']['textRotation'] = $styleAttributeValue;
 
+                    break;
+                case 'Indent':
+                    $style['alignment']['indent'] = $styleAttributeValue;
+
                     break;
             }
         }


Test patch:
diff --git a/tests/PhpSpreadsheetTests/Reader/Xml/Issue4448Test.php b/tests/PhpSpreadsheetTests/Reader/Xml/Issue4448Test.php
new file mode 100644
index 000000000..8a60e8696
--- /dev/null
+++ b/tests/PhpSpreadsheetTests/Reader/Xml/Issue4448Test.php
@@ -0,0 +1,33 @@
+<?php
+
+declare(strict_types=1);
+
+namespace PhpOffice\PhpSpreadsheetTests\Reader\Xml;
+
+use PhpOffice\PhpSpreadsheet\Reader\Xml;
+use PHPUnit\Framework\TestCase;
+
+class Issue4448Test extends TestCase
+{
+    private static string $testbook = 'tests/data/Reader/Xml/issue.4448.xml';
+
+    public function testIndent(): void
+    {
+        $reader = new Xml();
+        $spreadsheet = $reader->load(self::$testbook);
+        $sheet = $spreadsheet->getActiveSheet();
+        self::assertSame(
+            5,
+            $sheet->getStyle('A2')
+                ->getAlignment()
+                ->getIndent()
+        );
+        self::assertSame(
+            0,
+            $sheet->getStyle('A1')
+                ->getAlignment()
+                ->getIndent()
+        );
+        $spreadsheet->disconnectWorksheets();
+    }
+}
diff --git a/tests/data/Reader/Xml/issue.4448.xml b/tests/data/Reader/Xml/issue.4448.xml
new file mode 100644
index 000000000..a7bbb9614
--- /dev/null
+++ b/tests/data/Reader/Xml/issue.4448.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<?mso-application progid="Excel.Sheet"?>
+<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
+ xmlns:o="urn:schemas-microsoft-com:office:office"
+ xmlns:x="urn:schemas-microsoft-com:office:excel"
+ xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
+ xmlns:html="http://www.w3.org/TR/REC-html40">
+ <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
+  <Author>owen</Author>
+  <LastAuthor>owen</LastAuthor>
+  <Created>2025-04-20T15:09:21Z</Created>
+  <Version>16.00</Version>
+ </DocumentProperties>
+ <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
+  <AllowPNG/>
+ </OfficeDocumentSettings>
+ <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
+  <WindowHeight>6630</WindowHeight>
+  <WindowWidth>19200</WindowWidth>
+  <WindowTopX>32767</WindowTopX>
+  <WindowTopY>32767</WindowTopY>
+  <ProtectStructure>False</ProtectStructure>
+  <ProtectWindows>False</ProtectWindows>
+ </ExcelWorkbook>
+ <Styles>
+  <Style ss:ID="Default" ss:Name="Normal">
+   <Alignment ss:Vertical="Bottom"/>
+   <Borders/>
+   <Font ss:FontName="Aptos Narrow" x:Family="Swiss" ss:Size="11"
+    ss:Color="#000000"/>
+   <Interior/>
+   <NumberFormat/>
+   <Protection/>
+  </Style>
+  <Style ss:ID="s63">
+   <Alignment ss:Horizontal="Left" ss:Vertical="Bottom" ss:Indent="5"/>
+  </Style>
+ </Styles>
+ <Worksheet ss:Name="Sheet1">
+  <Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="3" x:FullColumns="1"
+   x:FullRows="1" ss:DefaultRowHeight="14.5">
+   <Row>
+    <Cell><Data ss:Type="String">a</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s63"><Data ss:Type="String">b</Data></Cell>
+   </Row>
+   <Row>
+    <Cell><Data ss:Type="String">c</Data></Cell>
+   </Row>
+  </Table>
+  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
+   <PageSetup>
+    <Header x:Margin="0.3"/>
+    <Footer x:Margin="0.3"/>
+    <PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
+   </PageSetup>
+   <Selected/>
+   <Panes>
+    <Pane>
+     <Number>3</Number>
+     <ActiveRow>1</ActiveRow>
+    </Pane>
+   </Panes>
+   <ProtectObjects>False</ProtectObjects>
+   <ProtectScenarios>False</ProtectScenarios>
+  </WorksheetOptions>
+ </Worksheet>
+</Workbook>