private InDesign.Color UpdateParagraphColor(InDesign.Paragraph paragraph, InDesign.Color color)
        {
            int wordsCount = paragraph.Words.Count;

            InDesign.Word lastWord = null;
            ContentColor  lastcc   = null;

            for (int i = 0; i < wordsCount; i++)
            {
                InDesign.Word word = null;
                if (i == 0)
                {
                    word = (InDesign.Word)paragraph.Words.FirstItem();
                }
                else
                {
                    word = (InDesign.Word)paragraph.Words.NextItem(lastWord);
                }

                if (lastWord != null && lastcc != null)
                {
                    lastWord.Contents  = lastcc.Content;
                    lastWord.FillColor = lastcc.Color;
                }

                string       content = word.Contents.ToString();
                ContentColor cc      = DetermineColor(content, color);
                color    = cc.Color;
                lastWord = word;
                lastcc   = cc;
            }

            if (lastWord != null && lastcc != null)
            {
                lastWord.Contents  = lastcc.Content;
                lastWord.FillColor = lastcc.Color;
            }

            //CheckByChar(paragraph);

            UpdateTableStyle(paragraph);

            return(color);
        }
        private ContentColor DetermineColor(string content, InDesign.Color lastColor)
        {
            InDesign.Color defaultColor = (InDesign.Color)colorTable[S_COLOR_PRE + "black"];

            /*
             * ((GS_COLOR_START)(Black))This is content 1 fr.
             * ((GS_COLOR_END)(Black))((GS_COLOR_START)(Blue))This
             * is content 2 fr.
             * ((GS_COLOR_END)(Blue))((GS_COLOR_START)(Black))
             * This is content 3 fr.((GS_COLOR_END)(Black)) */

            InDesign.Color color = lastColor == null ? defaultColor : lastColor;
            Match          m     = regS.Match(content);

            if (m != null && m.Success)
            {
                string colorHere = m.Groups[1].Value;
                color = (InDesign.Color)colorTable[S_COLOR_PRE + colorHere.ToLower()];

                if (color == null)
                {
                    color = lastColor == null ? defaultColor : lastColor;
                }
            }

            string newContent = regS.Replace(content, "");

            newContent = regE.Replace(newContent, "");

            ContentColor cc = new ContentColor();

            cc.Color   = color;
            cc.Content = newContent;

            return(cc);
        }