没有重现问题,请参考附件中的xml和下面的代码,可以正常导出pdf
我估计还是你这边特定的xml的问题,有可能是不是图片本身的原因引起的
- OpenFileDialog odlg = new OpenFileDialog();
- if (odlg.ShowDialog() == DialogResult.OK)
- {
- if (odlg.FileName.Substring(odlg.FileName.LastIndexOf('.') + 1)=="xml")
- this.fpSpread1.Open(odlg.FileName);
- if (odlg.FileName.Substring(odlg.FileName.LastIndexOf('.') + 1) == "xls"|| odlg.FileName.Substring(odlg.FileName.LastIndexOf('.') + 1)=="xlsx")
- this.fpSpread1.Open(odlg.FileName);
- if (fpSpread1.Sheets.Count > 0)
- {
- PrintInfo p = new PrintInfo() { PrintToPdf = true, PdfFileName = odlg.FileName + ".pdf" };
- fpSpread1.SetPrintInfo(p,-1);
- fpSpread1.PrintSheet(-1);
- }
- }
复制代码
|
|