powered by simpleCommunicator - 2.0.56     © 2025 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Не получается добавить DataBar в табличку Excel.
3 сообщений из 3, страница 1 из 1
Не получается добавить DataBar в табличку Excel.
    #37984099
Фотография Gena928
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Вот что записал макрос в Экселе:
Код: 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
Не получается добавить DataBar в табличку Excel.
    #38407666
topgunxs
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Привет из Перу.
У меня была такая же проблема, после долгих испытаний, и положил игнорировать ошибки, если 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
Не получается добавить DataBar в табличку Excel.
    #38408014
Фотография Gena928
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
topgunxs,

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


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