简体   繁体   中英

EPPlus C# x axis type "Text axis"

I am using EPPlus for creating excel with charts. I am struggling now for 2 days to set the x axis type to "text axis" and not "automatically select...". Can somebody help me how to achieve this?

在此处输入图片说明

Thanks in advance

Already solved by myself. For everyone who is interested in, following code did the trick:

var chartXml = chart.ChartXml;
var nsm = new XmlNamespaceManager(chartXml.NameTable);
var nsuri = chartXml.DocumentElement.NamespaceURI;

nsm.AddNamespace("c", nsuri);
var textNode = chartXml.SelectSingleNode("c:chartSpace/c:chart/c:plotArea/c:catAx/c:auto/@val", nsm);
if (textNode != null)
    textNode.Value = "0";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM