public void Patterned(MsoPatternType pattern)
 {
     object[] paramArray = new object[1];
     paramArray[0] = pattern;
     InstanceType.InvokeMember("Patterned", BindingFlags.InvokeMethod, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);
 }
Esempio n. 2
0
        /// <summary>
        /// Lấy màu pattern
        /// </summary>
        /// <param name="msoPatternType"></param>
        /// <param name="background"></param>
        /// <param name="foreground"></param>
        /// <returns></returns>
        private PatternColor GetPatternColor(MsoPatternType msoPatternType, pp.ColorFormat background, pp.ColorFormat foreground)
        {
            PatternColor patternColor = new PatternColor();

            patternColor.Background = GetSolidColor(background);
            patternColor.Foreground = GetSolidColor(foreground);
            switch (msoPatternType)
            {
            case MsoPatternType.msoPattern5Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT05;
                break;

            case MsoPatternType.msoPattern10Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT10;
                break;

            case MsoPatternType.msoPattern20Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT20;
                break;

            case MsoPatternType.msoPattern25Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT25;
                break;

            case MsoPatternType.msoPattern30Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT30;
                break;

            case MsoPatternType.msoPattern40Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT40;
                break;

            case MsoPatternType.msoPattern50Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT50;
                break;

            case MsoPatternType.msoPattern60Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT60;
                break;

            case MsoPatternType.msoPattern70Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT70;
                break;

            case MsoPatternType.msoPattern75Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT75;
                break;

            case MsoPatternType.msoPattern80Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT80;
                break;

            case MsoPatternType.msoPattern90Percent:
                patternColor.HatchStyle = HatchStyle.HS_PERCENT90;
                break;

            case MsoPatternType.msoPatternDarkHorizontal:
                patternColor.HatchStyle = HatchStyle.HS_DARKHORIZONTAL;
                break;

            case MsoPatternType.msoPatternDarkVertical:
                patternColor.HatchStyle = HatchStyle.HS_DARKVERTICAL;
                break;

            case MsoPatternType.msoPatternDarkDownwardDiagonal:
                patternColor.HatchStyle = HatchStyle.HS_DARKDOWNWARDDIAGONAL;
                break;

            case MsoPatternType.msoPatternDarkUpwardDiagonal:
                patternColor.HatchStyle = HatchStyle.HS_DARKUPWARDDIAGONAL;
                break;

            case MsoPatternType.msoPatternSmallCheckerBoard:
                patternColor.HatchStyle = HatchStyle.HS_SMALLCHECKERBOARD;
                break;

            case MsoPatternType.msoPatternTrellis:
                patternColor.HatchStyle = HatchStyle.HS_TRELLIS;
                break;

            case MsoPatternType.msoPatternLightHorizontal:
                patternColor.HatchStyle = HatchStyle.HS_LIGHTHORIZONTAL;
                break;

            case MsoPatternType.msoPatternLightVertical:
                patternColor.HatchStyle = HatchStyle.HS_LIGHTVERTICAL;
                break;

            case MsoPatternType.msoPatternLightDownwardDiagonal:
                patternColor.HatchStyle = HatchStyle.HS_LIGHTDOWNWARDDIAGONAL;
                break;

            case MsoPatternType.msoPatternLightUpwardDiagonal:
                patternColor.HatchStyle = HatchStyle.HS_LIGHTUPWARDDIAGONAL;
                break;

            case MsoPatternType.msoPatternSmallGrid:
                patternColor.HatchStyle = HatchStyle.HS_SMALLGRID;
                break;

            case MsoPatternType.msoPatternDottedDiamond:
                patternColor.HatchStyle = HatchStyle.HS_DOTTEDDIAMOND;
                break;

            case MsoPatternType.msoPatternWideDownwardDiagonal:
                patternColor.HatchStyle = HatchStyle.HS_WIDEDOWNWARDDIAGONAL;
                break;

            case MsoPatternType.msoPatternWideUpwardDiagonal:
                patternColor.HatchStyle = HatchStyle.HS_WIDEUPWARDDIAGONAL;
                break;

            case MsoPatternType.msoPatternDashedUpwardDiagonal:
                patternColor.HatchStyle = HatchStyle.HS_DASHEDUPWARDDIAGONAL;
                break;

            case MsoPatternType.msoPatternDashedDownwardDiagonal:
                patternColor.HatchStyle = HatchStyle.HS_DASHEDDOWNWARDDIAGONAL;
                break;

            case MsoPatternType.msoPatternNarrowVertical:
                patternColor.HatchStyle = HatchStyle.HS_NARROWVERTICAL;
                break;

            case MsoPatternType.msoPatternNarrowHorizontal:
                patternColor.HatchStyle = HatchStyle.HS_NARROWHORIZONTAL;
                break;

            case MsoPatternType.msoPatternDashedVertical:
                patternColor.HatchStyle = HatchStyle.HS_DASHEDVERTICAL;
                break;

            case MsoPatternType.msoPatternDashedHorizontal:
                patternColor.HatchStyle = HatchStyle.HS_DASHEDHORIZONTAL;
                break;

            case MsoPatternType.msoPatternLargeConfetti:
                patternColor.HatchStyle = HatchStyle.HS_LARGECONFETTI;
                break;

            case MsoPatternType.msoPatternLargeGrid:
                patternColor.HatchStyle = HatchStyle.HS_LARGEGRID;
                break;

            case MsoPatternType.msoPatternHorizontalBrick:
                patternColor.HatchStyle = HatchStyle.HS_HORIZONTALBRICK;
                break;

            case MsoPatternType.msoPatternLargeCheckerBoard:
                patternColor.HatchStyle = HatchStyle.HS_LARGECHECKERBOARD;
                break;

            case MsoPatternType.msoPatternSmallConfetti:
                patternColor.HatchStyle = HatchStyle.HS_SMALLCONFETTI;
                break;

            case MsoPatternType.msoPatternZigZag:
                patternColor.HatchStyle = HatchStyle.HS_ZIGZAG;
                break;

            case MsoPatternType.msoPatternSolidDiamond:
                patternColor.HatchStyle = HatchStyle.HS_SOLIDDIAMOND;
                break;

            case MsoPatternType.msoPatternDiagonalBrick:
                patternColor.HatchStyle = HatchStyle.HS_DIAGONALBRICK;
                break;

            case MsoPatternType.msoPatternOutlinedDiamond:
                patternColor.HatchStyle = HatchStyle.HS_OUTLINEDDIAMOND;
                break;

            case MsoPatternType.msoPatternPlaid:
                patternColor.HatchStyle = HatchStyle.HS_PLAID;
                break;

            case MsoPatternType.msoPatternSphere:
                patternColor.HatchStyle = HatchStyle.HS_SPHERE;
                break;

            case MsoPatternType.msoPatternWeave:
                patternColor.HatchStyle = HatchStyle.HS_WEAVE;
                break;

            case MsoPatternType.msoPatternDottedGrid:
                patternColor.HatchStyle = HatchStyle.HS_DOTTEDGRID;
                break;

            case MsoPatternType.msoPatternDivot:
                patternColor.HatchStyle = HatchStyle.HS_DIVOT;
                break;

            case MsoPatternType.msoPatternShingle:
                patternColor.HatchStyle = HatchStyle.HS_SHINGLE;
                break;

            case MsoPatternType.msoPatternWave:
                patternColor.HatchStyle = HatchStyle.HS_WAVE;
                break;

            case MsoPatternType.msoPatternHorizontal:
                patternColor.HatchStyle = HatchStyle.HS_HORIZONTAL;
                break;

            case MsoPatternType.msoPatternVertical:
                patternColor.HatchStyle = HatchStyle.HS_VERTICAL;
                break;

            case MsoPatternType.msoPatternCross:
                patternColor.HatchStyle = HatchStyle.HS_DIAGONALCROSS;
                break;

            case MsoPatternType.msoPatternDownwardDiagonal:
                patternColor.HatchStyle = HatchStyle.HS_DASHEDDOWNWARDDIAGONAL;
                break;

            case MsoPatternType.msoPatternUpwardDiagonal:
                patternColor.HatchStyle = HatchStyle.HS_DASHEDUPWARDDIAGONAL;
                break;

            case MsoPatternType.msoPatternDiagonalCross:
                patternColor.HatchStyle = HatchStyle.HS_DIAGONALCROSS;
                break;

            default:
                break;
            }

            return(patternColor);
        }