iOfficeAI / iOfficeAI/OfficeCLI
[PPTX] view html does not preserve several drawing, text, and equation properties
- Dominant language
- C#
- Stars
- 30.7k
- Forks
- 2.1k
- Avg merge
- 9d 8h
- Merged PRs (30d)
- 5
Description
## Environment
- OfficeCLI: 1.0.144
- Command: `officecli view sample.pptx html`
## Summary
Several PPTX properties are rendered incorrectly in the raw HTML generated directly by OfficeCLI.
### 1. A bent connector is partially missing
A `bentConnector4` connector is only partially visible.
The generated SVG uses:
```html
viewBox="0 0 100 100"
```
However, its polyline contains an X coordinate as large as `2136.27`, so part of the connector falls
outside the SVG view box.
Example source object:
- Path: `/slide[5]/connector[@id=16]`
- Size: approximately `2.42pt × 103.82pt`
- Rotation: `180`
Expected: the complete connector is visible.
Actual: part of the connector is clipped or missing.
### 2. Alignment inherited from a slide layout is ignored
A slide-number placeholder is right-aligned in `ppt/slideLayouts/slideLayout1.xml` using:
```xml
```
The generated HTML paragraph does not contain:
```css
text-align: right;
```
As a result, the slide number appears on the left side of its placeholder.
Direct right alignment works correctly. A normal text box containing:
```xml
```
is rendered with:
```css
text-align: right;
```
Expected: the effective alignment inherited from the slide layout is applied.
Actual: the inherited right alignment is omitted.
### 3. `noFill` text outlines are rendered as black strokes
Some text runs contain:
```xml
```
OfficeCLI converts this to:
```css
-webkit-text-stroke: 1px #000000;
paint-order: stroke fill;
```
Expected: no visible text stroke.
Actual: a 1px black stroke is added, making the text appear blurred or darker.
### 4. Equation font size and inline/display layout are not preserved
The font size associated with an OfficeMath equation is not applied to the generated KaTeX element.
For example, an equation associated with:
```xml
```
should be rendered at 12pt, but the generated HTML uses:
```html
```
The equation span has no font size of its own and therefore uses the default paragraph size instead
of the equation's run size.
The generated script also unconditionally calls:
```javascript
katex.render(el.dataset.formula, el, {
throwOnError: false,
displayMode: true
});
```
This treats inline `` equations as display equations, changing their vertical spacing and
placement relative to surrounding text.
Expected:
- Preserve the effective font size of each equation.
- Render `` as inline math.
- Render `` as display math.
Actual:
- The equation uses a default or inherited font size.
- Every equation is rendered in display mode.
Related issue: [#228](https://github.com/iOfficeAI/OfficeCLI/issues/228)
That issue fixed missing equations and extraction of multiple equations, but the proposed equation-
size and inline/display-mode changes were not included in the accepted fix.
### 5. Simplified Chinese fonts are preferred for Japanese fallback
When the source font is unavailable, the generated font family resembles:
```css
font-family:
'',
'PingFang SC',
'Microsoft YaHei',
'Noto Sans CJK SC',
'Hiragino Sans GB',
sans-serif;
```
For Japanese text, this may select Simplified Chinese glyphs before an appropriate Japanese font.
Expected: for Japanese content, Japanese fallback fonts such as the following should be preferred
before Simplified Chinese fonts:
```text
Noto Sans JP
Noto Sans CJK JP
Yu Gothic
Meiryo
Hiragino Sans
```
All of these problems are present in the unmodified HTML produced directly by OfficeCLI.
Contributor guide
Research direction
Reproduce `officecli view sample.pptx html` and inspect the generated SVG, HTML, and KaTeX script against `/slide[5]/connector[@id=16]`, `ppt/slideLayouts/slideLayout1.xml`, and the listed `a:rPr` and `a:ln` examples. Compare the behavior with related issue #228; done means all five reported rendering problems match their stated expectations, including connector bounds, inherited alignment, noFill outlines, equation sizing and mode, and Japanese font fallback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, html, javascript
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100