remove duplicate code in XpsExporter