Why appending AutoFilter corrupts my excel file in this example?

前端 未结 2 1199
星月不相逢
星月不相逢 2020-12-02 00:51

Hi I use the below method to apply an AutoFilter :

public static void ApplyAutofilter(string fileName, string sheetName, string reference)
        {
                 


        
2条回答
  •  遥遥无期
    2020-12-02 00:59

    Nice! this works! It helped me to solve my problem. Using the following made the difference

    OpenXmlElement preceedingElement = GetPreceedingElement(worksheetPart);
    worksheetPart.Worksheet.InsertAfter(autoFilter, preceedingElement);
    

提交回复
热议问题