Hi Friends,

i still somewhat new with Go and need a little tutoring: I have to create 
Excel files, using the *excelize* package and wrote a little function to 
store data from a map[string]int64 into a column within the worksheet:

// 
-------------------------------------------------------------------------------------------------
// Store a slice of int64 data items into the cells of a column
// 
-------------------------------------------------------------------------------------------------
func SetColumnValuesInt64(xf *excelize.File,
      p_SheetName string,
      p_StartRow int, 
      p_Column rune, 
      p_CellStyle *excelize.Style,
      p_Keys *UTL_StringSlice.T_StringSlice, 
      p_Values *map[string]int64) {
   Row := p_StartRow
   StyleID,_ := xf.NewStyle(p_CellStyle)
   for _,Key := range(*p_Keys) {
     CellAddress := fmt.Sprintf("%c%d",p_Column,Row)
     xf.SetCellValue(p_SheetName,CellAddress,(*p_Values)[Key])
     xf.SetCellStyle(p_SheetName,CellAddress,CellAddress,StyleID)
    Row++
   } // END for 
} // END SetColumnValuesInt64

Basically the function iterates through a slice of strings, containing the 
key-values for the data-map and then calls the *SetCellValue* function from 
the *excelize* package to store the number into the cell.
Now i have another set of data, stored into a map[string]*float64 …*
So i duplicated the above function, just replacing the red line with
      p_Values *map[string]float64) {

Basically it is the same code, just the parameter-type is different. I 
looked into the definition of the function *SetCellValue  *and saw that it 
is using the empty interface as parameter for the value, so i tried to 
define my function with
      p_Values *map[string]interface{}) {

The function compiles fine, but if i try to use it with a *map[string]int64 
as a parameter, the compiler objectst with the message »*cannot use Amounts 
(variable of type *map[string]int64) as type *map[string]interface{} in 
argument to ExcelFormats.SetColumnValues*«

Can somebody please give me hint what i am doing wrong?

Thank you very much in advance for your help.

Best regards from Charleston (WV),
     Frank/2

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ff6cbe1d-df62-42c3-aff0-e62b6631f772n%40googlegroups.com.

Reply via email to