public deliveryUnitItemSimpleRenderOutput(ITextRender __builder, reportOutputFormatName __format, IEnumerable <reportElementLevel> __newDirectoryLevels) : base(deliveryUnitItemType.content) { name = __builder.GetType().Name.add(__format.ToString(), "-"); location = deliveryUnitItemLocationBase.unknown; flags = deliveryUnitItemFlags.none; outputRender = __builder; format = __format; levelsOfNewDirectory.AddRange(__newDirectoryLevels); //builder = new builderSelector(); //builder.Add(__builder, __format); //builder.setActiveOutputFormat(__format); }
/// <summary> /// Makes filename from <c>filenameBase</c> according to specified <c>format</c>. /// </summary> /// <remarks>If <c>format</c> is not supported throws <see cref="ArgumentOutOfRangeException"/>. For <c>none</c> returns default</remarks> /// <param name="filenameBase">Filename base - automatically trims any existing extension</param> /// <param name="format">Targeted output format</param> /// <returns>filename with proper extension</returns> /// <exception cref="System.ArgumentOutOfRangeException">format</exception> public String getFilename(String filenameBase, reportOutputFormatName format = reportOutputFormatName.none) { String dir = Path.GetDirectoryName(filenameBase); if (format == reportOutputFormatName.none) { format = defaultFormat; } if (format == reportOutputFormatName.unknown) { format = defaultFormat; } if (!supported.Contains(format)) { String exmsg = String.Format("Supplied output format is not supported: format {0}, supported formats {1}", format.ToString(), supported.toCsvInLine(";")); throw new ArgumentOutOfRangeException("format", this, exmsg); } filenameBase = Path.GetFileNameWithoutExtension(filenameBase); String output = filenameBase; throw new NotImplementedException("Format resolve not implemented yet"); // output = imbSciStringExtensions.add(output, format.getDefaultExtension(), "."); if (!imbSciStringExtensions.isNullOrEmptyString(dir)) { output = imbSciStringExtensions.add(dir, output, "\\"); } return(output); }
/// <summary> /// Gets the filename extension for <c>format</c>. String is without starting dot. /// </summary> /// <param name="format">The format.</param> /// <returns></returns> public static String getFilenameExtension(this reportOutputFormatName format) { String extension = "bin"; switch (format) { case reportOutputFormatName.sheetPDF: case reportOutputFormatName.docPDF: extension = "pdf"; break; case reportOutputFormatName.sheetCsv: case reportOutputFormatName.csv: extension = "csv"; break; case reportOutputFormatName.sheetExcel: case reportOutputFormatName.Excel: extension = "xlsx"; break; case reportOutputFormatName.folderReadme: case reportOutputFormatName.textMdFile: case reportOutputFormatName.markdown: extension = "md"; break; case reportOutputFormatName.textLog: extension = "log"; break; case reportOutputFormatName.emailPlainText: case reportOutputFormatName.unknown: case reportOutputFormatName.textFile: extension = "txt"; break; case reportOutputFormatName.sheetXML: case reportOutputFormatName.textXml: case reportOutputFormatName.serXml: case reportOutputFormatName.xml: extension = "xml"; break; case reportOutputFormatName.sheetHtml: case reportOutputFormatName.textHtml: case reportOutputFormatName.emailHTML: case reportOutputFormatName.docHTML: case reportOutputFormatName.htmlViaMD: case reportOutputFormatName.htmlReport: extension = "html"; break; case reportOutputFormatName.docRTF: extension = "rtf"; break; case reportOutputFormatName.docJPG: extension = "jpg"; break; case reportOutputFormatName.docTIFF: extension = "tiff"; break; case reportOutputFormatName.docPNG: extension = "png"; break; case reportOutputFormatName.rdf: extension = "rdf"; break; case reportOutputFormatName.owl: extension = "owl"; break; case reportOutputFormatName.json: extension = "json"; break; case reportOutputFormatName.Writter: extension = "odt"; break; case reportOutputFormatName.Calc: extension = "ods"; break; case reportOutputFormatName.textCss: extension = "css"; break; case reportOutputFormatName.docXAML: extension = "xaml"; break; case reportOutputFormatName.Word: extension = "docx"; break; case reportOutputFormatName.none: extension = ""; break; default: extension = format.ToString(); if (extension.StartsWith("text")) { extension = "txt"; } else if (extension.EndsWith("log")) { extension = "log"; } else { throw new ArgumentOutOfRangeException("format", "Extension not defined yet -> aceCommonTypes.extensions.imbEnumConverterExtensions.getFilenameExtension(this reportOutputFormatName format)"); } break; } return(extension); }
/// <summary> /// xes the scope automatic save. /// </summary> /// <param name="oldScope">The old scope.</param> /// <exception cref="System.NotImplementedException"> /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"></exception> public virtual void x_scopeAutoSave(IMetaContentNested oldScope) { throw new aceReportException("This method is deprecated" + "Don-t use this"); reportElementLevel level = oldScope.elementLevel; reportOutputForm form = settings.forms[level].form; if (form == reportOutputForm.none) { return; } IMetaComposeAndConstruct conScope = oldScope as IMetaComposeAndConstruct; IMetaContentNested metaScope = oldScope as IMetaContentNested; string path = ""; reportOutputFormatName fileformat = settings.forms[level].fileformat; if (metaScope is metaServicePage) { // form = conScope.form; metaServicePage msp = metaScope as metaServicePage; log(string.Format("---- service page scoped --> overriding *form* {0} and format *{1}* for {2}", form.ToString(), fileformat.ToString(), oldScope.GetType().Name)); } if (form == reportOutputForm.unknown) { //form = conScope.form; log(string.Format("---- use _reportOutputForm_ default *{0}* from {1}", form.ToString(), oldScope.GetType().Name)); } if (form == reportOutputForm.folder) { base.directoryScope = base.directoryScope.Parent; log(" directory *parent* scoped: " + base.directoryScope.FullName); } string filename = ""; if (form == reportOutputForm.file) { filename = settings.formats.getFilename(metaScope.name, fileformat); // path = directoryCurrent.FullName.add(filename, "\\"); switch (level) { case reportElementLevel.documentSet: throw new NotImplementedException(); break; case reportElementLevel.document: string fn = metaScope.document.name; throw new NotImplementedException(); // render.AppendInfo(data, false, settings.forms[level].customProperties.ToArray()); //render.saveDocument(fn, getWritableFileMode.autoRenameExistingOnOtherDate, fileformat); break; case reportElementLevel.page: throw new NotImplementedException(); //render.savePage(oldScope.name, fileformat); //render.AppendInfo(data, false, settings.forms[level].customProperties.ToArray()); break; case reportElementLevel.block: throw new NotImplementedException(); break; case reportElementLevel.servicepage: break; default: throw new ArgumentOutOfRangeException(); } } //PropertyCollection mdata = metaScope.AppendDataFields(data); }
/// <summary> /// xes the scope automatic create. /// </summary> /// <param name="newScope">The new scope.</param> /// <exception cref="System.NotImplementedException"> /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"></exception> public virtual void x_scopeAutoCreate(IMetaContentNested newScope) { throw new aceReportException("This method is deprecated" + "Don-t use this"); reportElementLevel level = newScope.elementLevel; reportOutputForm form = settings.forms[level].form; IMetaComposeAndConstruct conScope = newScope as IMetaComposeAndConstruct; IMetaContentNested metaScope = newScope as IMetaContentNested; string path = ""; reportOutputFormatName fileformat = settings.forms[level].fileformat; if (metaScope is metaServicePage) { //form = conScope.form; metaServicePage msp = metaScope as metaServicePage; if (doVerboseLog) { log(string.Format("---- service page scoped in --> overriding *form* {0} and format *{1}* for {2}", form.ToString(), fileformat.ToString(), newScope.GetType().Name)); } } if (form == reportOutputForm.none) { return; } if (form == reportOutputForm.unknown) { // form = conScope.form; if (doVerboseLog) { log(string.Format("---- use _reportOutputForm_ default *{0}* from {1}", form.ToString(), newScope.GetType().Name)); } } if (form == reportOutputForm.folder) { if (directoryScope == null) { if (script.flags.HasFlag(docScriptFlags.nullDirectoryToCurrent)) { directoryScope = new DirectoryInfo(Directory.GetCurrentDirectory()); log(string.Format("-- Directory scope was null - now it is set to [{0}] -- scope path is: {1}", directoryScope.FullName, scope.path)); } else { throw new aceReportException("DirectoryCurrent is null!"); } } path = directoryScope.FullName.add(newScope.name, "\\"); if (Directory.Exists(path)) { directoryScope = new DirectoryInfo(path); log(string.Format("-- scope to existing folder: {0} for {1}", path, newScope.GetType().Name)); } else { directoryScope = Directory.CreateDirectory(path); log(string.Format("-- create and scope to folder: {0} for {1}", path, newScope.GetType().Name)); } } string filename = ""; if (form == reportOutputForm.file) { filename = settings.formats.getFilename(metaScope.name, settings.forms[level].fileformat); // path = directoryCurrent.FullName.add(filename, "\\"); switch (level) { case reportElementLevel.documentSet: _outputRepositorium.Clear(); break; case reportElementLevel.document: throw new NotImplementedException(); //render.addDocument(newScope.name, true, getWritableFileMode.overwrite, fileformat); break; case reportElementLevel.page: throw new NotImplementedException(); //render.addPage(newScope.name, true, getWritableFileMode.overwrite, fileformat);/ break; case reportElementLevel.block: throw new NotImplementedException(); break; case reportElementLevel.servicepage: // log("-- service page is scoped in"); break; default: throw new ArgumentOutOfRangeException(); } } if (form == reportOutputForm.inParentFile) { switch (level) { case reportElementLevel.servicepage: throw new NotImplementedException(); // render.addPage(newScope.name, true, getWritableFileMode.overwrite, fileformat); break; case reportElementLevel.page: throw new NotImplementedException(); //render.addPage(newScope.name, true, getWritableFileMode.overwrite, fileformat); break; } } }