Exemplo n.º 1
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets exporter object by identificator.
        /// </summary>
        /// <param name="identificator">Export type identificator (name or file extension).</param>
        /// <returns>Unifed document exporter.</returns>
        private static IDocumentExport _GetExporter(string identificator)
        {
            Debug.Assert(!string.IsNullOrEmpty(identificator));

            IDocumentExport export = null;

            // select export format type
            switch (identificator)
            {
            case EXPORT_EXTENSION_HTM:
            case EXPORT_TYPE_NAME_HTM:
                export = new HtmlExport();
                break;

            case EXPORT_EXTENSION_PDF:
            case EXPORT_TYPE_NAME_PDF:
                export = new PdfExport();
                break;

            case EXPORT_EXTENSION_RTF:
            case EXPORT_TYPE_NAME_RTF:
                export = new RtfExport();
                break;

            case EXPORT_EXTENSION_TIF:
            case EXPORT_TYPE_NAME_TIF:
                export = new TiffExport();
                break;

            case EXPORT_EXTENSION_TXT:
            case EXPORT_TYPE_NAME_TXT:
                export = new TextExport();
                break;

            case EXPORT_EXTENSION_XLS:
            case EXPORT_TYPE_NAME_XLS:
                export = new XlsExport();
                break;

            default:
                Debug.Assert(false);     // NOTE: not supported
                break;
            }

            return(export);
        }
Exemplo n.º 2
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Gets exporter object by identificator.
        /// </summary>
        /// <param name="identificator">Export type identificator (name or file extension).</param>
        /// <returns>Unifed document exporter.</returns>
        private static IDocumentExport _GetExporter(string identificator)
        {
            Debug.Assert(!string.IsNullOrEmpty(identificator));

            IDocumentExport export = null;
            // select export format type
            switch (identificator)
            {
                case EXPORT_EXTENSION_HTM:
                case EXPORT_TYPE_NAME_HTM:
                    export = new HtmlExport();
                    break;

                case EXPORT_EXTENSION_PDF:
                case EXPORT_TYPE_NAME_PDF:
                    export = new PdfExport();
                    break;

                case EXPORT_EXTENSION_RTF:
                case EXPORT_TYPE_NAME_RTF:
                    export = new RtfExport();
                    break;

                case EXPORT_EXTENSION_TIF:
                case EXPORT_TYPE_NAME_TIF:
                    export = new TiffExport();
                    break;

                case EXPORT_EXTENSION_TXT:
                case EXPORT_TYPE_NAME_TXT:
                    export = new TextExport();
                    break;

                case EXPORT_EXTENSION_XLS:
                case EXPORT_TYPE_NAME_XLS:
                    export = new XlsExport();
                    break;

                default:
                    Debug.Assert(false); // NOTE: not supported
                    break;
            }

            return export;
        }