Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Не получается добавить DataBar в табличку Excel. / 3 сообщений из 3, страница 1 из 1
04.10.2012, 16:55
    #37984099
Gena928
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Не получается добавить DataBar в табличку Excel.
Вот что записал макрос в Экселе:
Код: vbnet
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
    Selection.FormatConditions.AddDatabar
    Selection.FormatConditions(Selection.FormatConditions.Count).ShowValue = True
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    
    With Selection.FormatConditions(1)
        .MinPoint.Modify newtype:=xlConditionValueAutomaticMin
        .MaxPoint.Modify newtype:=xlConditionValueAutomaticMax
    End With
    
    With Selection.FormatConditions(1).BarColor
        .Color = 15698432
        .TintAndShade = 0
    End With
    
    
    Selection.FormatConditions(1).BarFillType = xlDataBarFillSolid
    Selection.FormatConditions(1).Direction = xlContext
    Selection.FormatConditions(1).NegativeBarFormat.ColorType = xlDataBarColor
    Selection.FormatConditions(1).BarBorder.Type = xlDataBarBorderNone
    Selection.FormatConditions(1).AxisPosition = xlDataBarAxisAutomatic
    With Selection.FormatConditions(1).AxisColor
        .Color = 0
        .TintAndShade = 0
    End With
    With Selection.FormatConditions(1).NegativeBarFormat.Color
        .Color = 255
        .TintAndShade = 0
    End With
    Range("T12").Select



Вот что конкретно не получается:
Код: vbnet
1.
2.
3.
4.
5.
6.
7.
Selection.FormatConditions(Selection.FormatConditions.Count).ShowValue = True
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    
    With Selection.FormatConditions(1)
        .MinPoint.Modify newtype:=xlConditionValueAutomaticMin
        .MaxPoint.Modify newtype:=xlConditionValueAutomaticMax
    End With



Начало работы:
Код: c#
1.
2.
3.
4.
5.
Range = WorkSheet.GetType().InvokeMember("Range", BindingFlags.GetProperty,
    null, WorkSheet, new object[] { _DatabarRange });

object _FormatConditions = Range.GetType().InvokeMember("FormatConditions", BindingFlags.GetProperty, null, Range, null);
_FormatConditions.GetType().InvokeMember("AddDatabar", BindingFlags.InvokeMethod, null,_FormatConditions, null);




Спасибо.
...
Рейтинг: 0 / 0
25.09.2013, 18:47
    #38407666
topgunxs
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Не получается добавить DataBar в табличку Excel.
Привет из Перу.
У меня была такая же проблема, после долгих испытаний, и положил игнорировать ошибки, если mostrabab увидел то, что хотел, и положил в удивлении комментарии прозвучали ошибку и исправить

.
.
.
.....
wran= "AO7:AO"+alltrim(str(fil-1))
olp.Range(wran).Select

WITH olp.Selection
.FormatConditions.AddDatabar
.FormatConditions(.FormatConditions.Count).ShowValue = .T.
.FormatConditions(.FormatConditions.Count).SetFirstPriority
endw
With olp.Selection.FormatConditions(1)
*!* .MinPoint.Modify(xlConditionValueAutomaticMin)
*!* .MaxPoint.Modify(xlConditionValueAutomaticMax)
With .BarColor
.Color = 5920255
.TintAndShade = 0
endw
EndW
*!* olp.Selection.FormatConditions(1).BarFillType = xlDataBarFillGradient
*!* olp.Selection.FormatConditions(1).Direction = xlContext
*!* olp.Selection.FormatConditions(1).NegativeBarFormat.ColorType = xlDataBarColor
*!* olp.Selection.FormatConditions(1).BarBorder.Type = xlDataBarBorderSolid
*!* olp.Selection.FormatConditions(1).NegativeBarFormat.BorderColorType = xlDataBarColor
*!* With olp.Selection.FormatConditions(1).BarBorder.Color
*!* .Color = 5920255
*!* .TintAndShade = 0
*!* EndW
*!* olp.Selection.FormatConditions(1).AxisPosition = xlDataBarAxisAutomatic
*!* With olp.Selection.FormatConditions(1).AxisColor
*!* .Color = 0
*!* .TintAndShade = 0
*!* EndW
*!* With olp.Selection.FormatConditions(1).NegativeBarFormat.Color
*!* .Color = 255
*!* .TintAndShade = 0
*!* EndW
*!* With olp.Selection.FormatConditions(1).NegativeBarFormat.BorderColor
*!* .Color = 255
*!* .TintAndShade = 0
*!* ENDWITH

olp.visible = .T.
...
Рейтинг: 0 / 0
26.09.2013, 09:22
    #38408014
Gena928
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Не получается добавить DataBar в табличку Excel.
topgunxs,

thanks a lot. i'll try to do it.
...
Рейтинг: 0 / 0
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Не получается добавить DataBar в табличку Excel. / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]