Ejemplo n.º 1
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 2, m_name);

            SfWord word = args[0] as SfWord;

            Utils.CheckNotNull(word, m_name);

            string imagePath          = Utils.GetSafeString(args, 1);
            float  horizontalPosition = (float)Utils.GetSafeDouble(args, 2);
            float  verticalPosition   = (float)Utils.GetSafeDouble(args, 3);
            string textWrap           = Utils.GetSafeString(args, 4, "InFrontOfText");
            string horizontalOrigin   = Utils.GetSafeString(args, 5, "Margin");
            string verticalOrigin     = Utils.GetSafeString(args, 6, "Margin");
            float  widthScale         = (float)Utils.GetSafeDouble(args, 7, 20f);
            float  heightScale        = (float)Utils.GetSafeDouble(args, 8, 20f);

            word.AddImage(imagePath, horizontalPosition, verticalPosition, textWrap,
                          horizontalOrigin, verticalOrigin, widthScale, heightScale);

            ParserFunction.UpdateFunction(word);
            return(word);
        }
Ejemplo n.º 2
0
        public override Variable Clone()
        {
            SfWord newVar = (SfWord)this.MemberwiseClone();

            newVar.m_id = ++m_counter;
            return(newVar);
        }
Ejemplo n.º 3
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            int margins = Utils.GetSafeInt(args, 0, 72);

            SfWord word = new SfWord(margins);

            return(word);
        }
Ejemplo n.º 4
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 1, m_name);

            string filename = Utils.GetSafeString(args, 0);

            SfWord word = new SfWord();

            word.Open(filename);

            return(word);
        }
Ejemplo n.º 5
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 2, m_name);

            SfWord word = args[0] as SfWord;

            Utils.CheckNotNull(word, m_name);

            string filename = Utils.GetSafeString(args, 1);

            word.Save(filename);

            ParserFunction.UpdateFunction(word);
            return(word);
        }
Ejemplo n.º 6
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 1, m_name);

            SfWord word = args[0] as SfWord;

            Utils.CheckNotNull(word, m_name);

            string styleStr     = Utils.GetSafeString(args, 1);
            string alignmentStr = Utils.GetSafeString(args, 2);

            word.ApplyStyle(styleStr, alignmentStr);

            ParserFunction.UpdateFunction(word);
            return(word);
        }
Ejemplo n.º 7
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 1, m_name);

            SfWord word = args[0] as SfWord;

            Utils.CheckNotNull(word, m_name);

            int    rows     = Utils.GetSafeInt(args, 1, 2);
            int    cols     = Utils.GetSafeInt(args, 2, 2);
            string styleStr = Utils.GetSafeString(args, 3);

            word.AddTable(rows, cols, styleStr);

            ParserFunction.UpdateFunction(word);
            return(word);
        }
Ejemplo n.º 8
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 1, m_name);

            SfWord word = args[0] as SfWord;

            Utils.CheckNotNull(word, m_name);

            string type   = Utils.GetSafeString(args, 1);
            float  indent = (float)Utils.GetSafeDouble(args, 2);
            int    row    = Utils.GetSafeInt(args, 3);
            int    col    = Utils.GetSafeInt(args, 4);

            word.AddParagraph(type, indent, row, col);

            ParserFunction.UpdateFunction(word);
            return(word);
        }
Ejemplo n.º 9
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 2, m_name);

            SfWord word = args[0] as SfWord;

            Utils.CheckNotNull(word, m_name);

            string text = Utils.GetSafeString(args, 1);

            text = text.Replace("\\n", "\n");
            text = text.Replace("\\t", "\t");

            word.AddText(text);

            ParserFunction.UpdateFunction(word);
            return(word);
        }
Ejemplo n.º 10
0
        protected override Variable Evaluate(ParsingScript script)
        {
            List <Variable> args = script.GetFunctionArgs();

            Utils.CheckArgs(args.Count, 2, m_name);

            SfWord word = args[0] as SfWord;

            Utils.CheckNotNull(word, m_name);

            string text      = Utils.GetSafeString(args, 1);
            string font      = Utils.GetSafeString(args, 2, "Calibri");
            float  fontSize  = (float)Utils.GetSafeDouble(args, 3, 12);
            string fontColor = Utils.GetSafeString(args, 4);
            string bgColor   = Utils.GetSafeString(args, 5);

            text = text.Replace("\\n", "\n");
            text = text.Replace("\\t", "\t");
            word.AddTextRange(text, font, fontSize, fontColor, bgColor);

            ParserFunction.UpdateFunction(word);
            return(word);
        }
Ejemplo n.º 11
0
 public SfWord(SfWord other)
 {
     m_id = ++m_counter;
 }