Exemple #1
0
		private void PublishWithExcel(IDocumentPublisher4 publisher, string sourceFilename, string destinationFilename)
		{
			if (null == publisher)
				return;

			OfficeApplicationCache officeApplicationCache = OfficeApplicationCache.Instance;

			object workbook = officeApplicationCache.OpenDocument(sourceFilename, false, FileType.ExcelSheet);
			try
			{
				publisher.PublishWithExcel(destinationFilename, workbook);
				officeApplicationCache.CloseDocument(workbook, false);
			}
			finally
			{
				Marshal.ReleaseComObject(workbook);
			}
		}