Laden...

[OpenXml] Fehler im Stylesheet für Fontsize

Erstellt von Caveman vor 3 Jahren Letzter Beitrag vor 3 Jahren 1.441 Views
Caveman Themenstarter:in
187 Beiträge seit 2009
vor 3 Jahren
[OpenXml] Fehler im Stylesheet für Fontsize

Hallo,

ich versuche mit dem OpenXML 2.5 bzw. 2.10 eine Exceldatei zu erzeugen.
Die Datei wird erstellt und kann auch mit Excel (2013/2016) geöffnet werden, nachdem die Fehler im Stylesheet durch Excel bereinigt (entfernt) wurden.

Ich schau mir jetzt schon seit Stunden den Vergleich im OpenXML Productivity Tool 2.5 an, aber ich sehe nicht, wo der Fehler in Fontsize liegen soll.
Die Fehlermeldung im Anhang.
Liegt das am x-Namespace?

Fehlerhafter Stylesheet (entpackte styles.xml aus der Exceldatei):

<?xml version="1.0" encoding="utf-8"?>
<x:styleSheet xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
	<x:fonts x14ac:knownFonts="1" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">
		<x:font>
			<x:name val="Consolas" />
			<x:family val="1" />
			<x:scheme val="minor" />
			<x:sz val="14" />
			<x:b />
			<x:color rgb="FF000000" />
		</x:font>
		<x:font>
			<x:name val="Consolas" />
			<x:family val="1" />
			<x:scheme val="minor" />
			<x:sz val="10" />
			<x:color rgb="FF000000" />
		</x:font>
	</x:fonts>
	<x:fills>
		<x:fill>
			<x:patternFill patternType="none" />
		</x:fill>
	</x:fills>
	<x:borders>
		<x:border />
	</x:borders>
	<x:cellXfs>
		<x:xf fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" />
		<x:xf fontId="1" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" />
	</x:cellXfs>
</x:styleSheet>

Nach der Reparatur durch Excel (entpackte styles.xml aus der Exceldatei):


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" 
			xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			mc:Ignorable="x14ac x16r2 xr" 
			xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" 
			xmlns:x16r2="http://schemas.microsoft.com/office/spreadsheetml/2015/02/main" 
			xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision">
	<fonts count="3" x14ac:knownFonts="1">
		<font>
			<b/>
			<sz val="14"/>
			<color rgb="FF000000"/>
			<name val="Calibri"/>
			<family val="1"/>
			<scheme val="minor"/>
		</font>
		<font>
			<b/>
			<sz val="14"/>
			<color rgb="FF000000"/>
			<name val="Consolas"/>
			<family val="3"/>
		</font>
		<font>
			<sz val="10"/>
			<color rgb="FF000000"/>
			<name val="Consolas"/>
			<family val="3"/>
		</font>
	</fonts>
	<fills count="2">
		<fill>
			<patternFill patternType="none"/>
		</fill>
		<fill>
			<patternFill patternType="gray125"/>
		</fill>
	</fills>
	<borders count="1">
		<border>
			<left/>
			<right/>
			<top/>
			<bottom/>
			<diagonal/>
		</border>
	</borders>
	<cellStyleXfs count="1">
		<xf numFmtId="0" fontId="0" fillId="0" borderId="0"/>
	</cellStyleXfs>
	<cellXfs count="3">
		<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>
		<xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/>
		<xf numFmtId="0" fontId="2" fillId="0" borderId="0" xfId="0" applyFont="1" applyFill="1" applyBorder="1"/>
	</cellXfs>
	<cellStyles count="1">
		<cellStyle name="Standard" xfId="0" builtinId="0"/>
	</cellStyles>
	<dxfs count="0"/>
	<tableStyles count="0" defaultTableStyle="TableStyleMedium2" defaultPivotStyle="PivotStyleLight16"/>
	<extLst>
		<ext uri="{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">
			<x14:slicerStyles defaultSlicerStyle="SlicerStyleLight1"/>
		</ext>
		<ext uri="{9260A510-F301-46a8-8635-F512D64BE5F5}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main">
			<x15:timelineStyles defaultTimelineStyle="TimeSlicerStyleLight1"/>
		</ext>
	</extLst>
</styleSheet>

Hat jemand einen Tip?

16.806 Beiträge seit 2008
vor 3 Jahren

Weit verbreiter Fehler ist, dass man versucht was im OpenXML zu verwenden, was in der jeweiligen Office Version nicht unterstützt wird.

Ich mag mich täuschen aber Deine Office Versionen dürften älter sein als die von Dir angegebenen OpenXML Versionen - und damit nicht supported.

PS: Fehlermeldungen gehören in die richtigen BB-Tags und nicht in ein Bild. Danke.
[Hinweis] Wie poste ich richtig?

Caveman Themenstarter:in
187 Beiträge seit 2009
vor 3 Jahren

Ursprünglich hatte ich die OpenXML Version 2.5 verwendet, da hierbei auch das Productivity Tool im Paket mit enthalten ist. Diese Version unterstützt Office von 2007 - 2013.
Und dass so was "einfaches" wie der Fontsize nicht unterstützt wird, kann ich mir nicht vorstellen!
Werde wohl nochmals von ganz vorne beginnen müssen, und die Styles schrittweise hinzufügen.

16.806 Beiträge seit 2008
vor 3 Jahren

Du meinst offenbar die Unterstützung des SDK. SDK Version != Schema Version.
Das hat aber nichts mit der Funktionalitätsunterstützung des Schemas zutun. Das kann zufälligerweise passen - garantiert ist das nicht.

So wie ich den Release Infos zumindest entnehme kam OpenXML 2.5 deutlich nach Excel 2007 raus. Ob nun Excel 2007 das neuere Schema unterstützt, sehe ich nicht.
Bitte les Dir doch das Zeug durch, das Du verwendest 😃