コード例 #1
0
 /// <summary>
 /// Generates an Excel (xml/xlsx) file with species observations count per polygon and for each selected taxon.
 /// </summary>
 /// <param name="filename">
 /// The filename (without file extension).
 /// </param>
 /// <param name="formatCountAsOccurrence">
 /// If set to <c>true</c> the observation count will be written as 1 if the count > 0 and 0 if count = 0;
 /// If set to <c>false</c> the observation count will be written.
 /// </param>
 /// <param name="addSettings"></param>
 /// <param name="addProvenance"></param>
 /// <returns>
 /// A Excel file of the type xml or xlsx.
 /// </returns>
 private FileResult TaxonSpecificSpeciesObservationCountPerPolygonAsExcel(string filename, bool formatCountAsOccurrence, bool addSettings = true, bool addProvenance = true)
 {
     SetServerDone();
     if (SessionHandler.MySettings.Presentation.FileFormat.ExcelFileSettings.IsSettingsDefault())
     {
         TaxonSpecificSpeciesObservationCountPerPolygonExcelXlsx file = FileExportManager.GetTaxonSpecificSpeciesObservationCountPerPolygonAsExcelXlsx(GetCurrentUser(), formatCountAsOccurrence, addSettings, addProvenance);
         MemoryStream returnStream = file.ToStream();
         return(File(returnStream, XlsxExcelFileMimeType, CreateXlsxExcelFileName(filename)));
     }
     else
     {
         TaxonSpecificSpeciesObservationCountPerPolygonExcelXml file = FileExportManager.GetTaxonSpecificSpeciesObservationCountPerPolygonAsExcelXml(GetCurrentUser(), formatCountAsOccurrence, addSettings, addProvenance);
         MemoryStream returnStream = file.ToStream();
         return(File(returnStream, XmlExcelFileMimeType, CreateXmlExcelFileName(filename)));
     }
 }
コード例 #2
0
        /// <summary>
        /// Generates an Excel (xlsx) file with species observations count per polygon and for each selected taxon.
        /// </summary>
        /// <param name="currentUser">The user context.</param>
        /// <param name="formatCountAsOccurrence">
        /// If set to <c>true</c> the observation count will be written as 1 if the count > 0 and 0 if count = 0;
        /// If set to <c>false</c> the observation count will be written.
        /// </param>
        /// <param name="addSettings">True if settings sheet should be included</param>
        /// <param name="addProvenance">True if provenance sheet should be included.</param>
        /// <returns>
        /// A Excel file of the type xlsx.
        /// </returns>
        public static TaxonSpecificSpeciesObservationCountPerPolygonExcelXlsx GetTaxonSpecificSpeciesObservationCountPerPolygonAsExcelXlsx(IUserContext currentUser, bool formatCountAsOccurrence, bool addSettings, bool addProvenance)
        {
            TaxonSpecificSpeciesObservationCountPerPolygonExcelXlsx file = new TaxonSpecificSpeciesObservationCountPerPolygonExcelXlsx(currentUser, formatCountAsOccurrence, addSettings, addProvenance);

            return(file);
        }