Hello together,
I have a problem with my Table. In the moment it is not possible to copy the rows and to paste them into excel. But that is how it has to work like.
Can anybody help me? It is the last step for me to finish my programm but I am a Newbie and I have no idea and I didn't found the right snippet.
Here is my code:
Regards
Andreas
I have a problem with my Table. In the moment it is not possible to copy the rows and to paste them into excel. But that is how it has to work like.
Can anybody help me? It is the last step for me to finish my programm but I am a Newbie and I have no idea and I didn't found the right snippet.
Here is my code:
- extension FourthViewController: NSTableViewDataSource, NSTableViewDelegate {
- func numberOfRowsInTableView(tableView: NSTableView) -> Int {
- let numberOfRows:Int = getDataArray().count
- return numberOfRows
- }
- func tableView(tableView: NSTableView!, objectValueForTableColumn tableColumn: NSTableColumn!, row: Int) -> AnyObject!
- {
- let newString = getDataArray().objectAtIndex(row).objectForKey(tableColumn.identifier)
- return newString;
- }
- func getDataArray () -> NSArray{
- var dataArray:[NSDictionary] = [["Erste": "Mary", "Zweite": "Jane"]];
- dataArray.removeAll()
- /
- let style = NSMutableParagraphStyle()
- style.alignment = .Right
- let myAttribute = [
- NSFontAttributeName: NSFont.boldSystemFontOfSize(13),
- NSParagraphStyleAttributeName: style
- ]
- if AMesse > 0 {
- dataArray += [["Erste": String(format:"\(AMesse) x Messe Kategorie A à %.2f Euro (netto)",locale: de,AMessePreis), "Zweite": String(format:"%.2f €", locale: de, (Double(AMesse) * AMessePreis))]]
- }
- if BMesse > 0 {
- dataArray += [["Erste": String(format:"\(BMesse) x Messe Kategorie B à %.2f Euro (netto)",locale: de,BMessePreis), "Zweite": String(format:"%.2f €", locale: de, (Double(BMesse) * BMessePreis))]]
- }
- if CMesse > 0 {
- dataArray += [["Erste": String(format:"\(CMesse) x Messe Kategorie C à %.2f Euro (netto)",locale: de,CMessePreis), "Zweite": String(format:"%.2f €", locale: de, (Double(CMesse) * CMessePreis))]]
- }
- if DMesse > 0 {
- dataArray += [["Erste": String(format:"\(DMesse) x Messe Kategorie D à %.2f Euro (netto)",locale: de,DMessePreis), "Zweite": String(format:"%.2f €", locale: de, (Double(DMesse) * DMessePreis))]]
- }
- if EMesse > 0 {
- dataArray += [["Erste": String(format:"\(EMesse) x Eintägige Messe à %.2f Euro (netto)",locale: de,EMessePreis), "Zweite": String(format:"%.2f €", locale: de, (Double(EMesse) * EMessePreis))]]
- }
- if AnzahlMesse + AnzahlMesseE >= 1{
- dataArray += [["Erste":NSAttributedString(string: "Gesamtbetrag der gebuchten vocatium/nordjob Messe(n) (netto)", attributes: myAttribute), "Zweite":NSAttributedString(string: String(format:"%.2f €", locale: de, (Double(AMesse) * AMessePreis + Double(BMesse) * BMessePreis + Double(CMesse) * CMessePreis + Double(DMesse) * DMessePreis + Double(EMesse) * EMessePreis)), attributes: myAttribute)]]
- }
- return dataArray;
- }
- }
Regards
Andreas