-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBCTableHtmlFormatter.h
executable file
·66 lines (46 loc) · 1.77 KB
/
BCTableHtmlFormatter.h
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// BCTableHtmlFormatter.h
// Bartender
//
// Created by Tom Houpt on 12/7/15.
// Copyright 2012 Behavioral Cybernetics LLC. All rights reserved.
//
#import <Cocoa/Cocoa.h>
/* USAGE:
#import <WebKit/WebKit.h>
WebView *myWebView; // be sure to allocate
NSMutableString *htmlBuffer; // be sure to allocate
// initialze the formater with your NSTableView
BCTableHtmlFormatter *htmlFormatter = [[BCTableHtmlFormatter alloc] initWithTableView:mTableView andTableID:@"myTableID"];
[htmlFormatter appendHtmlToString:htmlBuffer];
// render the table in the NSWebView
[[myWebView mainFrame] loadHTMLString:htmlString baseURL:nil];
*/
// table cells without stringValue are given text @"--"
// unless headerCell stringValue is @"" (blank column name),
// in which case the cells are made blank (@" ")
#define kBlankCellText @" "
#define kNoDataCellText @"--"
@interface BCTableHtmlFormatter : NSObject {
NSTableView *tableView;
NSString *tableID;
BOOL useAlternatingRowColors;
BOOL useVerticalLines;
BOOL useHorizontalLines;
BOOL useCaption;
BOOL useRowNumbers;
}
/**
<#Description#>
@param table an NSTableView to be converted to html
@param tid an html id label for use on web page
@return an initialized HTMLTableFormatter; now when appendHtmlToString is called, the contents of the NSTableView will be converted to an html table, then appended to the string
*/
- (id) initWithTableView:(NSTableView *)table andTableID:(NSString *)tid;
- (void) setTableView:(NSTableView *)table;
- (NSString *) htmlString;
- (void) appendCssToString:(NSMutableString *)buffer;
- (void) appendHtmlToString:(NSMutableString *)buffer;
- (void) appendHeadersToString:(NSMutableString *)buffer;
- (void) appendRowAtIndex:(NSInteger)rowIndex toString:(NSMutableString *)buffer;
@end