예제 #1
0
        /// <summary>
        /// This is where all the excitement happens. We update the specified group
        /// with the data from the spreadsheet row.
        /// </summary>
        /// <param name="row"></param>
        /// <param name="group"></param>
        private void PutRowInGroup(ContentRow row, XmlElement group)
        {
            var sheetLanguages = _sheet.Languages;

            foreach (var lang in sheetLanguages)
            {
                var colIndex = _sheet.GetRequiredColumnForLang(lang);
                var content  = row.GetCell(colIndex).Content;
                var editable = HtmlDom.GetEditableChildInLang(group, lang);
                if (editable == null)
                {
                    if (IsEmptyCell(content))
                    {
                        continue;                         // Review: or make an empty one?
                    }
                    editable = TranslationGroupManager.MakeElementWithLanguageForOneGroup(group, lang);
                }

                if (IsEmptyCell(content))
                {
                    editable.ParentNode.RemoveChild(editable);
                }
                else
                {
                    editable.InnerXml = content;
                }
            }

            if (RemoveOtherLanguages)
            {
                HtmlDom.RemoveOtherLanguages(@group, sheetLanguages);
            }
        }