src/BloomExe/Spreadsheet/SpreadsheetImporter.cs
/// <summary>
/// Import the spreadsheet into the dom
/// </summary>
/// <returns>a list of warnings</returns>
Import the spreadsheet into the dom
Import the spreadsheet into the dom
public List<string> Import(InternalSpreadsheet sheet, IWebSocketProgress progress = null)
		{
			_sheet = sheet;
			_progress = progress ?? new NullWebSocketProgress();
			Progress("Importing spreadsheet...");
			_warnings = new List<string>();
			_inputRows = _sheet.ContentRows.ToList();
			_pages = _dest.GetPageElements().ToList();
			_bookIsLandscape = _pages[0]?.Attributes["class"]?.Value?.Contains("Landscape") ?? false;
			_currentRowIndex = 0;
			_currentPageIndex = -1;
			_groupsOnPage = new List<XmlElement>();
			_imageContainersOnPage = new List<XmlElement>();
			while (_currentRowIndex < _inputRows.Count)
			{
				var currentRow = _inputRows[_currentRowIndex];
				string rowTypeLabel = currentRow.MetadataKey;
				if (rowTypeLabel == InternalSpreadsheet.PageContentRowLabel)
				{
					bool rowHasImage = !string.IsNullOrWhiteSpace(currentRow.GetCell(InternalSpreadsheet.ImageSourceColumnLabel).Text);
					bool rowHasText = RowHasText(currentRow);
					if (rowHasImage && rowHasText)
					{
						AdvanceToNextGroupAndImageContainer();
					} else if (rowHasImage)
					{
						AdvanceToNextImageContainer();
					} else if (rowHasText)
					{
						AdvanceToNextGroup();
					}
					if (rowHasImage)
					{
						PutRowInImage(currentRow);
					}
					if (rowHasText) {
						PutRowInGroup(currentRow, _currentGroup);
					}
				}
				else if (rowTypeLabel[0]=='[' && rowTypeLabel[rowTypeLabel.Length - 1]==']') 
				{
					string dataBookLabel = rowTypeLabel.Substring(1, rowTypeLabel.Length - 2); 
					UpdateDataDivFromRow(currentRow, dataBookLabel);
				}
				_currentRowIndex++;
			}
			Progress("Done");
			return _warnings;
		}
public List < string > Import ( InternalSpreadsheet sheet , IWebSocketProgress progress = null ) { _sheet = sheet ; _progress = progress ?? new NullWebSocketProgress ( ) ; Progress ( " " ) ; _warnings = new List < string > ( ) ; _inputRows = _sheet . ContentRows . ToList ( ) ; _pages = _dest . GetPageElements ( ) . ToList ( ) ; _bookIsLandscape = _pages [ 0 ] ? . Attributes [ " " ] ? . Value ? . Contains ( " " ) ?? false ; _currentRowIndex = 0 ; _currentPageIndex = - 1 ; _groupsOnPage = new List < XmlElement > ( ) ; _imageContainersOnPage = new List < XmlElement > ( ) ; while ( _currentRowIndex < _inputRows . Count ) { var currentRow = _inputRows [ _currentRowIndex ] ; string rowTypeLabel = currentRow . MetadataKey ; if ( rowTypeLabel == InternalSpreadsheet . PageContentRowLabel ) { bool rowHasImage = ! string . IsNullOrWhiteSpace ( currentRow . GetCell ( InternalSpreadsheet . ImageSourceColumnLabel ) . Text ) ; bool rowHasText = RowHasText ( currentRow ) ; if ( rowHasImage && rowHasText ) { AdvanceToNextGroupAndImageContainer ( ) ; } else if ( rowHasImage ) { AdvanceToNextImageContainer ( ) ; } else if ( rowHasText ) { AdvanceToNextGroup ( ) ; } if ( rowHasImage ) { PutRowInImage ( currentRow ) ; } if ( rowHasText ) { PutRowInGroup ( currentRow , _currentGroup ) ; } } else if ( rowTypeLabel [ 0 ] == ' ' && rowTypeLabel [ rowTypeLabel . Length - 1 ] == ' ' ) { string dataBookLabel = rowTypeLabel . Substring ( 1 , rowTypeLabel . Length - 2 ) ; UpdateDataDivFromRow ( currentRow , dataBookLabel ) ; } _currentRowIndex ++ ; } Progress ( " " ) ; return _warnings ; }
Import the spreadsheet into the dom
Import the spreadsheet into the dom
//This row is xmatter //remove brackets
a list of warnings
a list of warnings
sheet
InternalSpreadsheet
progress
IWebSocketProgress